We introduced the EventDispatcher in #219 to handle the banner, but this has introduced a side-effect when the PHAR is overwritten (by SelfUpdateCommand), in that the PHAR content has changed and so the subsequent class loads will fail.
Reproducer:
$ php box.phar compile && php pie.phar self-update --nightly
<box compile snipped>
🥧 PHP Installer for Extensions (PIE) 0.11.0@5d7fa4f, from The PHP Foundation
You are running PHP 8.4.6
Target PHP installation: 8.4.6 nts, on Linux/OSX/etc x86_64 (from /usr/bin/php8.4)
Downloading the latest nightly release.
✅ Verified the new PIE version
✅ PIE has been upgraded to nightly
icense information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Util;
use Composer\XdebugHandler\XdebugHandler;
/**
* Provides ini file location functions that work with and without a restart.
* When the process has restarted it uses a tmp ini and stores the original
* ini locations in an environment variable.
*
* @author John Stevenson <john-stevenson@blueyonder.co.uk>
*/
class IniHelper
{
/**
* Returns an array of php.ini locations with at least one entry
*
* The equivalent of calling php_ini_loaded_file then php_ini_scanned_files.
* The loaded ini location is the first entry and may be empty.
*
* @return string[]
*/
public static function getAll(): array
{
return XdebugHandler::getAllIniFiles();
}
/**
* Describes the location of the loaded php.ini file(s)
*/
public static function getMessage(): string
{
$paths = self::getAll();
if (empty($paths[0])) {
array_shift($paths);
}
$ini = array_shift($paths);
if (empty($ini)) {
return 'A php.ini file does not exist. You will have to create one.';
}
if (!ePHP Fatal error: Uncaught Error: Class "Symfony\Component\Console\Event\ConsoleTerminateEvent" not found in phar:///home/james/workspace/phpf/pie/pie.phar/vendor/symfony/console/Application.php:1110
Stack trace:
#0 phar:///home/james/workspace/phpf/pie/pie.phar/vendor/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand()
#1 phar:///home/james/workspace/phpf/pie/pie.phar/vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun()
#2 phar:///home/james/workspace/phpf/pie/pie.phar/bin/pie(53): Symfony\Component\Console\Application->run()
#3 /home/james/workspace/phpf/pie/pie.phar(15): require('...')
#4 {main}
thrown in phar:///home/james/workspace/phpf/pie/pie.phar/vendor/symfony/console/Application.php on line 1110
We introduced the
EventDispatcherin #219 to handle the banner, but this has introduced a side-effect when the PHAR is overwritten (bySelfUpdateCommand), in that the PHAR content has changed and so the subsequent class loads will fail.Reproducer: