You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is basically a reopen of #532 with new details. It still doesn't work.
How to reproduce?
git clone [email protected]:martinssipenko/php-scoper-issue.git
cd php-scoper-issue
composer install
wget -q https://github.com/humbug/box/releases/download/4.0.2/box.phar --output-document=./box
chmod +x box
./box compile
# and test generated PHAR
./test.phar
Result:
PHP Fatal error: Uncaught Error: Class "_HumbugBoxc78d51bc45e9\Composer\InstalledVersions" not found in phar:///tmp/temp/php-scoper-issue/test.phar/cli.php:8
Stack trace:
#0 /tmp/temp/php-scoper-issue/test.phar(14): require()#1 {main}
thrown in phar:///tmp/temp/php-scoper-issue/test.phar/cli.php on line 8
then, after generating new test.phar everything works as expected.
I think that PHP-Scoper (or Box) doesn't properly handle vendor/composer/InstalledVersions.php file. Without scoper.inc.php, this file is prefixed (has a prefix in a namespace), however vendor/composer/autoload_classmap.php contains not prefixed key:
<?php// autoload_classmap.php @generated by Composer$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
returnarray(
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
// ^^^^^^ look at this, it's not prefixed
);
Bug report
This is basically a reopen of #532 with new details. It still doesn't work.
How to reproduce?
Result:
Workaround
If I add the following
scoper.inc.php
:then, after generating new
test.phar
everything works as expected.I think that PHP-Scoper (or Box) doesn't properly handle
vendor/composer/InstalledVersions.php
file. Withoutscoper.inc.php
, this file is prefixed (has a prefix in a namespace), howevervendor/composer/autoload_classmap.php
contains not prefixed key:Related to infection/infection#1708
The text was updated successfully, but these errors were encountered: