Skip to content

Commit

Permalink
Try to fix PHAR autoloading issue
Browse files Browse the repository at this point in the history
The PHAR autoloader does not load the Symfony polyfill bootstrap files.
That's why the PHAR is crashing if not intl extension is loaded.

 - Updated to latest Box version
 - Copied a hack from PHPStand
  • Loading branch information
sebastianfeldmann committed Aug 20, 2024
1 parent c9deaef commit fe4c5b6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
4 changes: 4 additions & 0 deletions bin/captainhook
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ use Symfony\Component\Console\Input\ArgvInput;

(static function($argv)
{
define('__CAPTAINHOOK_RUNNING__', true);

// check installation type [composer bin dir, git clone / phar, composer package dir]
$composerAutoloadLocations = [
__DIR__ . '/../autoload.php',
Expand All @@ -65,6 +67,8 @@ use Symfony\Component\Console\Input\ArgvInput;
exit(1);
}

$GLOBALS['__composer_autoload_files'] = [];

try {
require CAPTAINHOOK_COMPOSER_AUTOLOAD;
} catch (Throwable $exception) {
Expand Down
6 changes: 3 additions & 3 deletions composer.phar.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"type": "library",
"description": "PHP git hook manager",
"keywords": ["git", "hooks", "pre-commit", "pre-push", "commit-msg", "prepare-commit-msg", "post-merge"],
"homepage": "https://github.com/captainhookphp/captainhook",
"homepage": "http://php.captainhook.info/",
"license": "MIT",
"authors": [
{
Expand Down Expand Up @@ -32,14 +32,14 @@
}
},
"require": {
"php": ">=7.2",
"php": ">=8.0",
"ext-json": "*",
"ext-spl": "*",
"ext-xml": "*",
"captainhook/secrets": "^0.9.4",
"sebastianfeldmann/camino": "^0.9.2",
"sebastianfeldmann/cli": "^3.3",
"sebastianfeldmann/git": "^3.9.3",
"sebastianfeldmann/git": "^3.10",
"symfony/console": "^5.0",
"symfony/filesystem": "^5.0",
"symfony/process": "^5.0"
Expand Down
4 changes: 2 additions & 2 deletions phive.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="phpunit" version="^9.4" installed="9.6.13" location="./tools/phpunit" copy="true"/>
<phar name="phpunit" version="^9.4" installed="9.6.20" location="./tools/phpunit" copy="true"/>
<phar name="humbug/box" version="^3.0.0" location="./tools/box" copy="true" installed="3.16.0"/>
<phar name="phpcs" version="^3.5" installed="3.7.2" location="./tools/phpcs" copy="true"/>
<phar name="phpstan" version="^1.0" installed="1.10.46" location="./tools/phpstan" copy="true"/>
<phar name="phpstan" version="^1.0" installed="1.11.11" location="./tools/phpstan" copy="true"/>
</phive>
2 changes: 1 addition & 1 deletion src/CH.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ final class CH
/**
* Current CaptainHook version
*/
public const VERSION = '5.23.3';
public const VERSION = '5.23.4-alpha-1';

/**
* Release date of the current version
Expand Down

0 comments on commit fe4c5b6

Please sign in to comment.