Skip to content

[Console] error while running inside phar #51254

Closed
@franksl

Description

@franksl

Symfony version(s) affected

6.3

Description

Hello,
We usually package console code inside phar's to create command line tools that are simple to distribute.
We are using phing to generate the phar.
Since moving from php 7.3 to 8.2 our Console based phard do not work anymore when simply initializing them.
This is due to some path problems inside Console code that cannot resolve relativ phar:// paths.
The error with stack we receive is:
PHP Fatal error: Uncaught UnexpectedValueException: DirectoryIterator::__construct(../Resources/): Failed to open directory: No such file or directory in phar:///path/to/myphar.phar/vendor/symfony/console/Command/DumpCompletionCommand.php:152 Stack trace: #0 phar:///path/to/myphar.phar/vendor/symfony/console/Command/DumpCompletionCommand.php(152): DirectoryIterator->__construct() #1 phar:///path/to/myphar.phar/vendor/symfony/console/Command/DumpCompletionCommand.php(55): Symfony\Component\Console\Command\DumpCompletionCommand->getSupportedShells() #2 phar:///path/to/myphar.phar/vendor/symfony/console/Command/Command.php(137): Symfony\Component\Console\Command\DumpCompletionCommand->configure() #3 phar:///path/to/myphar.phar/vendor/symfony/console/Application.php(1136): Symfony\Component\Console\Command\Command->__construct() #4 phar:///path/to/myphar.phar/vendor/symfony/console/Application.php(1312): Symfony\Component\Console\Application->getDefaultCommands() #5 phar:///path/to/myphar.phar/vendor/symfony/console/Application.php(536): Symfony\Component\Console\Application->init() #6 phar:///path/to/myphar.phar/vendor/symfony/console/Application.php(522): Symfony\Component\Console\Application->add()

Thanks to anyone that can give me a solution,
Frank

How to reproduce

Create a simple application and wrap it inside a phar archive, then run the archive

Possible Solution

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions