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

[1.x] Explode argument option issue losing a part of the argument when multiple = in one line is used #182

Merged
merged 1 commit into from
Feb 14, 2020

Conversation

nickkuijpers
Copy link
Contributor

@nickkuijpers nickkuijpers commented Feb 14, 2020

I have added a limit to the explode of the argument to prevent losing a part of the argument when for example passing a url with query parameters with multiple = values in the argument value.

When passing a URL with query parameters as argument to Envoy, currently it explodes the = value which then is filled back in to the $options array. But by doing this, it losses argument values which has got more than 1 = statement in the argument value.

So for example the following command currently will result in this.

php bin/envoy run foo --argument=http://domain.com?key=value

currently results into:

http://domain.com?key

instead of what it should be:

http://domain.com?key=value

So by adding a limit to the following explode

Currently:

$option = explode('=', substr($argument, 2));

New:

$option = explode('=', substr($argument, 2), 2);

which results in maintaining additional = values in the argument.

http://domain.com?key=value

I have unit tested the current tests and it succeeded, i don't think it will be a issue updating this as the current arguments are still in tact and no changes are made in that.

…for example passing a url with query parameters
Copy link
Member

@driesvints driesvints left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can confirm this fixes the problem.

@driesvints driesvints changed the title Explode argument option issue losing a part of the argument when multiple = in one line is used [1.x] Explode argument option issue losing a part of the argument when multiple = in one line is used Feb 14, 2020
@nickkuijpers
Copy link
Contributor Author

Perfect, happy to help.

@taylorotwell taylorotwell merged commit c5fd60c into laravel:1.x Feb 14, 2020
@driesvints
Copy link
Member

@nickkuijpers thanks!

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

Successfully merging this pull request may close these issues.

3 participants