Skip to content

Commit 2704ee6

Browse files
committed
Fix test case
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.
1 parent e36daa6 commit 2704ee6

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

ext/xmlwriter/tests/bug79029.phpt

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,31 @@
11
--TEST--
22
#79029 (Use After Free's in XMLReader / XMLWriter)
33
--SKIPIF--
4-
<?php if (!extension_loaded("xmlwriter")) print "skip"; ?>
4+
<?php
5+
if (!extension_loaded("xmlwriter")) print "skip xmlwriter extension not available";
6+
if (!extension_loaded("xmlreader")) print "skip xmlreader extension not available";
7+
?>
58
--FILE--
69
<?php
710
$x = array( new XMLWriter() );
8-
$x[0]->openUri("bug79029.txt");
11+
$x[0]->openUri("bug79029_1.txt");
912
$x[0]->startComment();
10-
@unlink("bug79029.txt");
1113

1214
$x = new XMLWriter();
13-
$x->openUri("bug79029.txt");
15+
$x->openUri("bug79029_2.txt");
1416
fclose(@end(get_resources()));
15-
@unlink("bug79029.txt");
1617

17-
file_put_contents("bug79029.txt", "a");
18+
file_put_contents("bug79029_3.txt", "a");
1819
$x = new XMLReader();
19-
$x->open("bug79029.txt");
20+
$x->open("bug79029_3.txt");
2021
fclose(@end(get_resources()));
21-
@unlink("bug79029.txt");
2222
?>
2323
okey
2424
--CLEAN--
2525
<?php
26-
@unlink("bug79029.txt");
26+
@unlink("bug79029_1.txt");
27+
@unlink("bug79029_2.txt");
28+
@unlink("bug79029_3.txt");
2729
?>
2830
--EXPECTF--
2931
Warning: fclose(): %d is not a valid stream resource in %sbug79029.php on line %d

0 commit comments

Comments
 (0)