]> granicus.if.org Git - php/commitdiff
- Turn the loader into a stream wrapper if necessary
authorMarcus Boerger <helly@php.net>
Mon, 28 May 2007 19:04:08 +0000 (19:04 +0000)
committerMarcus Boerger <helly@php.net>
Mon, 28 May 2007 19:04:08 +0000 (19:04 +0000)
ext/phar/phar.php
ext/phar/phar/pharcommand.inc

index b6e899cb73c5a8b64ca15586082bad059887d8ab..121d7cb636138c85af3366e3104a8fea8ab5727e 100644 (file)
@@ -524,12 +524,18 @@ class PharCommand extends CLICommand
                        {
                                $c = file_get_contents($stub);
                                $s = '';
+
                                if (substr($c,0,2) == '#!') {
                                        $s.= substr($c,0,strpos($c, "\n")+1);
                                }                               
-                               $s.= '<?php if (!class_exists("Phar",0) && !class_exists("PHP_Archive")) { ?>';
-                               $s.= file_get_contents($loader);
-                               $s.= '<?php class Phar extends PHP_Archive {} } ?>';
+
+                               $s .= '<?php if (!class_exists("Phar",0) && !class_exists("PHP_Archive")) { ?>';
+                               $s .= file_get_contents($loader);
+                $s .= '<?php class Phar extends PHP_Archive { } ';
+                $s .= '} ';
+                $s .= 'if (!in_array(\'phar\', stream_get_wrappers())) { stream_wrapper_register(\'phar\', \'Phar\'); } ';
+                $s .= '?>';
+
                                if (substr($c,0,1) == '#') {
                                        $s.= substr($c,strpos($c, "\n")+1);
                                }
index 4497802a75d09f36e976e546fff95898e32167e8..8ac6ea12a718f693be999f41642c31964ada4e6f 100755 (executable)
@@ -411,7 +411,10 @@ class PharCommand extends CLICommand
 
                 $s .= '<?php if (!class_exists("Phar",0) && !class_exists("PHP_Archive")) { ?>';
                 $s .= file_get_contents($loader);
-                $s .= '<?php class Phar extends PHP_Archive { } }?>';
+                $s .= '<?php class Phar extends PHP_Archive { } ';
+                $s .= '} ';
+                $s .= 'if (!in_array(\'phar\', stream_get_wrappers())) { stream_wrapper_register(\'phar\', \'Phar\'); } ';
+                $s .= '?>';
 
                 if (substr($c,0,1) == '#') {
                     $s.= substr($c,strpos($c, "\n")+1);