support for running .ext.phars without ext/phar
[pharext/pharext] / src / pharext / Task / PharCompress.php
index ea0607f39a6e9291a91204b9cdcfa7a97d0a2e20..78a93493018dd3eded7797c670bf87483567219b 100644 (file)
@@ -58,12 +58,10 @@ class PharCompress implements Task
                if ($verbose) {
                        printf("Compressing %s ...\n", basename($this->package->getPath()));
                }
+               /* stop shebang */
+               $stub = $this->package->getStub();
                $phar = $this->package->compress($this->encoding);
-               $meta = $phar->getMetadata();
-               if (isset($meta["stub"])) {
-                       /* drop shebang */
-                       $phar->setDefaultStub($meta["stub"]);
-               }
+               $phar->setStub(substr($stub, strpos($stub, "\n")+1));
                return $this->file . $this->extension;
        }
 }