Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions ext/phar/phar_object.c
Original file line number Diff line number Diff line change
Expand Up @@ -4492,7 +4492,6 @@ PHP_METHOD(PharFileInfo, __construct)

entry_obj->entry = entry_info;
if (!entry_info->is_persistent && !entry_info->is_temp_dir) {
++entry_info->fp_refcount;
/* The phar data must exist to keep the alias locked. */
ZEND_ASSERT(!phar_data->is_persistent);
++phar_data->refcount;
Expand Down Expand Up @@ -4540,7 +4539,6 @@ PHP_METHOD(PharFileInfo, __destruct)
efree(entry);
entry_obj->entry = NULL;
} else if (!entry->is_persistent) {
--entry->fp_refcount;
/* The entry itself still lives in the manifest,
* which will either be freed here if the file info was the last reference; or freed later. */
entry_obj->entry = NULL;
Expand Down
31 changes: 31 additions & 0 deletions ext/phar/tests/SplFileInfo_openFile_write.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
--TEST--
SplFileInfo::openFile() in write mode
--EXTENSIONS--
phar
--INI--
phar.readonly=0
--FILE--
<?php

$phar = new Phar(__DIR__.'/SplFileInfo_openFile_write.phar');
$phar->addFromString('test', 'contents');
var_dump($phar['test']->openFile('w'));

?>
--CLEAN--
<?php
@unlink(__DIR__.'/SplFileInfo_openFile_write.phar');
?>
--EXPECTF--
object(SplFileObject)#%d (%d) {
["pathName":"SplFileInfo":private]=>
string(%d) "phar://%stest"
["fileName":"SplFileInfo":private]=>
string(4) "test"
["openMode":"SplFileObject":private]=>
string(1) "w"
["delimiter":"SplFileObject":private]=>
string(1) ","
["enclosure":"SplFileObject":private]=>
string(1) """
}
Loading