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

Schedule::compileParameters does not escape certain arguments #15996

Closed
inxilpro opened this issue Oct 18, 2016 · 3 comments
Closed

Schedule::compileParameters does not escape certain arguments #15996

inxilpro opened this issue Oct 18, 2016 · 3 comments

Comments

@inxilpro
Copy link
Contributor

inxilpro commented Oct 18, 2016

  • Laravel Version: 5.2 and 5.3
  • PHP Version: n/a
  • Database Driver & Version: n/a

Description:

The method Illuminate\Console\Scheduling\Schedule::compileParameters runs:

return collect($parameters)->map(function ($value, $key) {
    return is_numeric($key) ? $value : $key.'='.(is_numeric($value) ? $value : ProcessUtils::escapeArgument($value));
})->implode(' ');

That means that if the $parameters array is numerically indexed, the scheduler does not escape the values. See Steps To Reproduce.

The fix is very simple, and I'm happy to submit a PR. I just want to make sure this is a bug and not intentional.

Steps To Reproduce:

// In App\Console\Kernel
protected function schedule(Schedule $schedule)
{
    $schedule->command('my:command', ['first argument'])->everyMinute();
}

This results in the command php artisan my:command first argument to be run, when my expected behavior is php artisan my:command 'first argument' (argument should be quoted).

@inxilpro
Copy link
Contributor Author

inxilpro commented Oct 19, 2016

Also, this is technically a backwards-incompatible change. If this behavior is unintentional, should I submit a PR against master or against 5.1?

@GrahamCampbell
Copy link
Member

5.3 or master please.

@GrahamCampbell
Copy link
Member

Probably master,

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

2 participants