1--TEST-- 2Bug #77432 (Segmentation fault on including phar file) 3--EXTENSIONS-- 4phar 5--INI-- 6opcache.enable=0 7error_reporting=-1 8phar.readonly=0 9--FILE-- 10<?php 11 12$filename = __DIR__ . '/bug77432.phar'; 13 14$phar = new Phar($filename); 15$phar->startBuffering(); 16$phar->addFromString('test.txt', 'text'); 17$phar->setStub('<?php echo "hello world\n"; __HALT_COMPILER(); ?>'); 18$phar->stopBuffering(); 19unset($phar); 20 21echo "--- Include 1 ---\n"; 22include("phar://" . $filename); 23echo "--- Include 2 ---\n"; 24// Note: will warn because the halting offset is redefined, but won't display the name because "zend_mangle_property_name" starts the name with \0 25// However, this is just the easiest way to reproduce it, so go with this test. 26include("phar://" . $filename); 27echo "--- After unlink ---\n"; 28unlink($filename); 29// This will just fail, as it should, but it is here to test the reopen error-handling path. 30include("phar://" . $filename); 31 32?> 33--CLEAN-- 34<?php 35@unlink(__DIR__ . '/bug77432.phar'); 36?> 37--EXPECTF-- 38--- Include 1 --- 39hello world 40--- Include 2 --- 41 42Warning: Constant already defined in %s on line %d 43hello world 44--- After unlink --- 45 46Warning: include(%sbug77432.phar): Failed to open stream: phar error: could not reopen phar "%sbug77432.phar" in %s on line %d 47 48Warning: include(): Failed opening '%sbug77432.phar' for inclusion (include_path=%s) in %s on line %d 49