mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
This stopped working after e735d2bc3b because fp_refcount is increased,
making phar think that the file has open read pointers.
To fix this, the refcount shouldn't be increased but that would
re-introduce the previous bug.
Instead, we need to add a field that "locks" the existence of the
internal entry separate from the refcount.
Closes GH-20473.
32 lines
672 B
PHP
32 lines
672 B
PHP
--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) """
|
|
}
|