File tree Expand file tree Collapse file tree 4 files changed +75
-0
lines changed
Expand file tree Collapse file tree 4 files changed +75
-0
lines changed Original file line number Diff line number Diff line change 1+ --TEST--
2+ Phar: Stream double free
3+ --EXTENSIONS--
4+ phar
5+ --INI--
6+ phar.readonly=0
7+ --ENV--
8+ USE_ZEND_ALLOC=0
9+ --FILE--
10+ <?php
11+
12+ declare (strict_types=1 );
13+
14+ require __DIR__ . '/gh18953/autoload.inc ' ;
15+
16+ // cleaning
17+ @unlink ("gh18953.phar " );
18+ @unlink ("gh18953.phar.gz " );
19+
20+ // create a phar
21+ $ phar = new Phar ("gh18953.phar " );
22+ $ phar ->startBuffering ();
23+ // add any dir
24+ $ phar ->addEmptyDir ("dir " );
25+ $ phar ->stopBuffering ();
26+ // compress
27+ $ phar ->compress (Phar::GZ );
28+
29+ // this increases the chance of reproducing the problem
30+ // even with this, it's not always reproducible
31+ $ obj1 = new NS1 \Class1 ();
32+ $ obj2 = new NS1 \Class1 ();
33+ $ obj2 = new NS1 \Class1 ();
34+ $ obj2 = new NS1 \Class1 ();
35+ $ obj2 = new NS1 \Class1 ();
36+
37+ echo "Done " . PHP_EOL ;
38+ ?>
39+ --CLEAN--
40+ <?php
41+ @unlink ("gh18953.phar " );
42+ @unlink ("gh18953.phar.gz " );
43+ ?>
44+ --EXPECT--
45+ Done
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ spl_autoload_register (function ($ class ) {
4+ $ base_dir = __DIR__ . '/src/ ' ;
5+
6+ $ file = $ base_dir . str_replace ('\\' , '/ ' , $ class ) . '.inc ' ;
7+ if (file_exists ($ file )) {
8+ require $ file ;
9+ }
10+ });
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace NS1 ;
6+
7+ use NS2 \Interface1 ;
8+
9+ class Class1 implements Interface1
10+ {
11+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace NS2 ;
6+
7+ interface Interface1
8+ {
9+ }
You can’t perform that action at this time.
0 commit comments