xref: /PHP-8.3/ext/xmlwriter/tests/bug79029.phpt (revision 74859783)
1--TEST--
2#79029 (Use After Free's in XMLReader / XMLWriter)
3--EXTENSIONS--
4xmlwriter
5xmlreader
6--FILE--
7<?php
8$x = array( new XMLWriter() );
9$x[0]->openUri("bug79029_1.txt");
10$x[0]->startComment();
11
12$y = new XMLWriter();
13$y->openUri("bug79029_2.txt");
14fclose(@end(get_resources()));
15
16file_put_contents("bug79029_3.txt", "a");
17$z = new XMLReader();
18$z->open("bug79029_3.txt");
19fclose(@end(get_resources()));
20?>
21okey
22--CLEAN--
23<?php
24@unlink("bug79029_1.txt");
25@unlink("bug79029_2.txt");
26@unlink("bug79029_3.txt");
27?>
28--EXPECTF--
29Warning: fclose(): %d is not a valid stream resource in %sbug79029.php on line %d
30
31Warning: fclose(): %d is not a valid stream resource in %sbug79029.php on line %d
32okey
33