Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to resolve the request "--" with chroot #20159

Open
gozoro opened this issue May 16, 2024 · 1 comment
Open

Unable to resolve the request "--" with chroot #20159

gozoro opened this issue May 16, 2024 · 1 comment

Comments

@gozoro
Copy link

gozoro commented May 16, 2024

What steps will reproduce the problem?

When php is launched with chroot as:

sudo /usr/sbin/chroot /opt/php55 /usr/bin/php "$@"

and in bash, run the command:

./yii

Method \yii\console\Request::resolve() throws exception 'yii\base\InvalidRouteException' with message 'Unable to resolve the request "--".'

What is the expected result?

I expected the route to resolve as "help".

What do you get instead?

This happens because $_SERVER['argv'] contains an array:

Array
(
    [0] => /var/www/my_project/yii
    [1] => --
)

and route resolved as NULL.

Additional info

Q A
Yii version 2.0.49
PHP version 5.5
Operating system Ubuntu 18.04
@gozoro
Copy link
Author

gozoro commented May 16, 2024

Fix.
Change this line

$route = array_shift($rawParams);

to

$route = (string)array_shift($rawParams);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant