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

Cannot use array as a parameter on request()->is() anymore #24902

Closed
markandrewkato opened this issue Jul 19, 2018 · 2 comments
Closed

Cannot use array as a parameter on request()->is() anymore #24902

markandrewkato opened this issue Jul 19, 2018 · 2 comments

Comments

@markandrewkato
Copy link

  • Laravel Version: 5.6.28
  • PHP Version: 7.2.5
  • Database Driver & Version: MySQL 5.7

Description:

After updating my Laravel version from 5.6.25 to 5.6.28, using array as a parameter on request()->is() doesn't work anymore. It shows the ff. error:

preg_quote() expects parameter 1 to be string, array given

I checked the file vendor/laravel/framework/src/Illuminate/Http/Request.php and saw that the function for "is" method has changed on the newer version.

I think its much easier to pass array on request()->is rather than doing multiple request()->is with a string parameter.

Steps To Reproduce:

Updated my Laravel version from 5.6.25 to 5.6.28, and using the ff. code doesn't work anymore:

if (request()->is(['pattern1', 'pattern2']))
@Miguel-Serejo
Copy link

Miguel-Serejo commented Jul 19, 2018

This is already being addressed #24885

In the meantime, you can fix it by simply splatting your array (->is(...$array))

@markandrewkato
Copy link
Author

I see. Thanks. Closing this issue.

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