mirror of
https://github.com/php/php-src.git
synced 2026-04-21 15:08:16 +02:00
2704ee6844
As of PHP 7.3.0, unlinking files with open handles is possible on Windows, but these file entries are still blocked until all open handles are closed. Since this test doesn't require to write to the same file, we use three separate files. We also add the missing skip check for XMLReader.
35 lines
851 B
PHP
35 lines
851 B
PHP
--TEST--
|
|
#79029 (Use After Free's in XMLReader / XMLWriter)
|
|
--SKIPIF--
|
|
<?php
|
|
if (!extension_loaded("xmlwriter")) print "skip xmlwriter extension not available";
|
|
if (!extension_loaded("xmlreader")) print "skip xmlreader extension not available";
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
$x = array( new XMLWriter() );
|
|
$x[0]->openUri("bug79029_1.txt");
|
|
$x[0]->startComment();
|
|
|
|
$x = new XMLWriter();
|
|
$x->openUri("bug79029_2.txt");
|
|
fclose(@end(get_resources()));
|
|
|
|
file_put_contents("bug79029_3.txt", "a");
|
|
$x = new XMLReader();
|
|
$x->open("bug79029_3.txt");
|
|
fclose(@end(get_resources()));
|
|
?>
|
|
okey
|
|
--CLEAN--
|
|
<?php
|
|
@unlink("bug79029_1.txt");
|
|
@unlink("bug79029_2.txt");
|
|
@unlink("bug79029_3.txt");
|
|
?>
|
|
--EXPECTF--
|
|
Warning: fclose(): %d is not a valid stream resource in %sbug79029.php on line %d
|
|
|
|
Warning: fclose(): %d is not a valid stream resource in %sbug79029.php on line %d
|
|
okey
|