diff --git a/ext/phar/phar.php b/ext/phar/phar.php index b6e899cb73c..121d7cb6361 100644 --- a/ext/phar/phar.php +++ b/ext/phar/phar.php @@ -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.= ''; - $s.= file_get_contents($loader); - $s.= ''; + + $s .= ''; + $s .= file_get_contents($loader); + $s .= ''; + if (substr($c,0,1) == '#') { $s.= substr($c,strpos($c, "\n")+1); } diff --git a/ext/phar/phar/pharcommand.inc b/ext/phar/phar/pharcommand.inc index 4497802a75d..8ac6ea12a71 100755 --- a/ext/phar/phar/pharcommand.inc +++ b/ext/phar/phar/pharcommand.inc @@ -411,7 +411,10 @@ class PharCommand extends CLICommand $s .= ''; $s .= file_get_contents($loader); - $s .= ''; + $s .= ''; if (substr($c,0,1) == '#') { $s.= substr($c,strpos($c, "\n")+1);