1--TEST-- 2Phar: attempt to create a Phar with relative path 3--SKIPIF-- 4<?php if (!extension_loaded("phar")) die("skip"); ?> 5--INI-- 6phar.require_hash=0 7phar.readonly=0 8--FILE-- 9<?php 10chdir(dirname(__FILE__)); 11try { 12 $p = new Phar('brandnewphar.phar'); 13 $p['file1.txt'] = 'hi'; 14 var_dump(strlen($p->getStub())); 15 $p->setStub("<?php 16function __autoload(\$class) 17{ 18 include 'phar://' . str_replace('_', '/', \$class); 19} 20Phar::mapPhar('brandnewphar.phar'); 21include 'phar://brandnewphar.phar/startup.php'; 22__HALT_COMPILER(); 23?>"); 24 var_dump($p->getStub()); 25} catch (Exception $e) { 26 echo $e->getMessage() . "\n"; 27} 28?> 29===DONE=== 30--CLEAN-- 31<?php 32unlink(dirname(__FILE__) . '/brandnewphar.phar'); 33?> 34--EXPECT-- 35int(6683) 36string(200) "<?php 37function __autoload($class) 38{ 39 include 'phar://' . str_replace('_', '/', $class); 40} 41Phar::mapPhar('brandnewphar.phar'); 42include 'phar://brandnewphar.phar/startup.php'; 43__HALT_COMPILER(); ?> 44" 45===DONE=== 46