From: Marcus Boerger Date: Tue, 29 May 2007 09:08:41 +0000 (+0000) Subject: - Improve header of pharcommand X-Git-Tag: RELEASE_1_4~20 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=490e076b2293ac213baf1a680831a145211d6175;p=php - Improve header of pharcommand --- diff --git a/ext/phar/phar/phar.php b/ext/phar/phar/phar.php index f19c9b7fee..93a938842c 100755 --- a/ext/phar/phar/phar.php +++ b/ext/phar/phar/phar.php @@ -10,19 +10,26 @@ * Phar Command */ -if (!extension_loaded("phar")) { - if (!class_exists("PHP_Archive")) { - echo "PHP_Archive not available.\n"; - exit(1); +if (!extension_loaded('phar')) +{ + if (!class_exists('PHP_Archive', 0)) + { + echo "Neither Extension Phar nor class PHP_Archive are available.\n"; + exit(1); } - - if (!class_exists("Phar")) { - class Phar extends PHP_Archive {} + if (!in_array('phar', stream_get_wrappers())) + { + stream_wrapper_register('phar', 'PHP_Archive'); + } + if (!class_exists('Phar',0)) { + require 'phar://'.__FILE__.'/phar.inc'; } } -foreach(array("SPL", "Reflection") as $ext) { - if (!extension_loaded($ext)) { +foreach(array("SPL", "Reflection") as $ext) +{ + if (!extension_loaded($ext)) + { echo "$argv[0] requires PHP extension $ext.\n"; exit(1); }