Allow .phar renaming
authorChristian Weiske <cweiske@cweiske.de>
Tue, 15 Dec 2015 06:43:09 +0000 (07:43 +0100)
committerChristian Weiske <cweiske@cweiske.de>
Tue, 15 Dec 2015 06:43:09 +0000 (07:43 +0100)
Without this code, trying to execute "php-sqllint" without the ".phar"
extension would result in a fatal error

> PHP Warning: require(..)
> failed to open stream: phar error: invalid url or non-existent phar

src/stub-phar.php

index 71f0586550989d836ce6d84628dc4c5624730d61..5c8629e23e2b44f2afe9ea2e7f46c1f0cd7af3d3 100644 (file)
@@ -12,6 +12,7 @@
  * @license   http://www.gnu.org/licenses/agpl.html GNU AGPL v3
  * @link      http://cweiske.de/php-sqllint.htm
  */
-require 'phar://' . __FILE__ . '/bin/phar-php-sqllint.php';
+Phar::mapPhar('php-sqllint.phar');
+require 'phar://php-sqllint.phar/bin/phar-php-sqllint.php';
 __HALT_COMPILER();
 ?>