summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2019-12-25 12:05:44 +0100
committerChristoph M. Becker <cmbecker69@gmx.de>2019-12-25 12:07:54 +0100
commit2704ee6844c03348de9d15e74646d09007ef0f7c (patch)
treebf4fbb8dc4b14a44da181fa774f87200e0ba5d14
parente36daa6927c05d2e687bb77495ef206cde118b33 (diff)
downloadphp-git-2704ee6844c03348de9d15e74646d09007ef0f7c.tar.gz
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.
-rw-r--r--ext/xmlwriter/tests/bug79029.phpt20
1 files changed, 11 insertions, 9 deletions
diff --git a/ext/xmlwriter/tests/bug79029.phpt b/ext/xmlwriter/tests/bug79029.phpt
index f329b62756..2e76a4e409 100644
--- a/ext/xmlwriter/tests/bug79029.phpt
+++ b/ext/xmlwriter/tests/bug79029.phpt
@@ -1,29 +1,31 @@
--TEST--
#79029 (Use After Free's in XMLReader / XMLWriter)
--SKIPIF--
-<?php if (!extension_loaded("xmlwriter")) print "skip"; ?>
+<?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.txt");
+$x[0]->openUri("bug79029_1.txt");
$x[0]->startComment();
-@unlink("bug79029.txt");
$x = new XMLWriter();
-$x->openUri("bug79029.txt");
+$x->openUri("bug79029_2.txt");
fclose(@end(get_resources()));
-@unlink("bug79029.txt");
-file_put_contents("bug79029.txt", "a");
+file_put_contents("bug79029_3.txt", "a");
$x = new XMLReader();
-$x->open("bug79029.txt");
+$x->open("bug79029_3.txt");
fclose(@end(get_resources()));
-@unlink("bug79029.txt");
?>
okey
--CLEAN--
<?php
-@unlink("bug79029.txt");
+@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