It appears when passing through an integer 0 (or any falsey value) to the route() helper or any other route URL generation function, a UrlGenerationException is thrown.
It appears this issue is caused by the following change in this PR: https://github.com/laravel/framework/pull/30714/files#diff-9ffa9921c8542da8cb0059fcbc3ad48aR218-R231
Since this is doing a non-strict type check on the Route Parameter value, it always returns false when any falsey value is given to it (as a blank string is equal to false in non-strict checks)
Route::get('/user/{id}/post/{post_id}', 'PostController@get')->name('user.post');route('user.post', [ 'id' => 1, 'post_id' => 0 ]);Missing required parameters for [Route: user.post] [URI: user/{id}/post/{post_id}]. (View: ...)Why would your post id be 0?
While it is unconventional, ids are typically unsigned integers. 0 is a valid id.
In one particular case, I have users that may or may not have accounts. An external service always attempts to load the user's account balance and doesn't handle null very well, so I use an account with id 0 that always has a balance of 0.
Yes that's true. I think this might be an easy fix to just check if it's 0 and let it pass through?
Funny I didn't use !empty just to avoid that and then I missed a =.
Sorry about that, I'll fix it later.
Sent in a fix here: https://github.com/laravel/framework/pull/30768
We did a new patch release with this fix.
Most helpful comment
Sent in a fix here: https://github.com/laravel/framework/pull/30768