ComposerRequireChecker icon indicating copy to clipboard operation
ComposerRequireChecker copied to clipboard

broken phar release

Open keradus opened this issue 4 years ago • 2 comments

If installed via composer:

ker@dus:~/github/PHP-CS-Fixer λ ./dev-tools/vendor/bin/composer-require-checker check composer.json --config-file=.composer-require-checker.json
ComposerRequireChecker v2.12.12-1-gd7da65d9
There were no unknown symbols found.

If downloaded as phar:

ker@dus:~/github/PHP-CS-Fixer λ ./composer-require-checker.phar check composer.json --config-file=.composer-require-checker.json 
ComposerRequireChecker 2.0.0

In JsonLoader.php line 25:
                                                 
  unable to read .composer-require-checker.json  
                                                 

check [--config-file CONFIG-FILE] [--ignore-parse-errors] [--] [<composer-json>]

keradus avatar Aug 31 '19 18:08 keradus

I am not familiar with phing ( I use humbug/box, originally box-project/box2 ), thus I won't be able to help with phing configuration, yet... stubfile created for phar file is the root cause.

if (in_array('phar', stream_get_wrappers()) && class_exists('Phar', 0)) {
Phar::interceptFileFuncs();
set_include_path('phar://' . __FILE__ . PATH_SEPARATOR . get_include_path());
Phar::webPhar(null, $web);
include 'phar://' . __FILE__ . '/' . Extract_Phar::START;
return;
}

interceptFileFuncs is the reason for crash i experience - https://www.php.net/manual/en/phar.interceptfilefuncs.php :

instructs phar to intercept fopen(), readfile(), file_get_contents(), opendir(), and all of the stat-related functions. If any of these functions is called from within a phar archive with a relative path, the call is modified to access a file within the phar archive

also, generated phar includes http handling (eg header('HTTP/1.0 404 Not Found');), no clue is it really needed, but i feel like the file is unnecessary larger for that


cc @maglnet @Ocramius

keradus avatar Aug 31 '19 19:08 keradus

Current work around is to pass the full path:

composer-require-checker.phar --config-file=`pwd`/.composer-require-checker.json

discordier avatar Oct 28 '19 19:10 discordier