-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
v9.15 has breaking change in route() helper: Unidentified array key 0 #42605
Comments
Closing this issue, because it's not as simple as initially stated. I will post a new issue if I can figure out what exactly causes this to break. |
It turns out that the issue only happens in a rather obscure edge case. Route::get('/foo', function() {
// ...
})->name('foo');
$url = route('foo', [User::first()]); This throws an error now. |
I swear to God, I must have hit every single possible edge case with my initial PR 🙈 The fix is rather straight forward, but I think this behavior is pretty weird to begin with (what does You might want to open this issue again in the meantime. |
@ksassnowski I completely agree it's a weird edge case. I believe it arose because the model used to be a route param, then the route definition was changed to not include the model, without updating the route() call. Like I said, it flew under the radar because the generated URL worked as expected, even though it had a non-sensical I'll re-open the issue as suggested. |
The PR already got merged by the way, so you can close the issue again 😅 #42606 |
Description:
In v9.15.0 calling the route() helper with model parameters in a non-associative array will result in an ErrorException "Unidentified array key 0" being thrown in Route.php line 539.
I realize that the use of non-associative arrays is no longer documented, but as long as the order of the parameters was correct, it has worked until v9.14.0.
If there have been any warnings in the upgrade guides that this would happen, I must have missed it. And it's especially unexpected in a minor release.
Steps To Reproduce:
The text was updated successfully, but these errors were encountered: