Closed nvahalik closed 1 week ago
@nvahalik - looks like this is patched and may be fixed in the next point release on the framework side to return null
again - https://github.com/laravel/framework/pull/51841
D'oh!
I guess I misunderstood. The PR actually fixes the problem. Doesn't cause it.
Just for safety, I've switched it to using array_shift
instead, and I've tagged that as v3.0.1
(as the bug was in Laravel 10).
Also merged the change into the Laravel 11 version, tagging v4.1.1
.
FYI both those version numbers apply to the laravel-json-api/validation
package.
Appears that how
shift()
works on a collection has changed:Laravel v10.48.12:
Laravel v10.48.13
The result of
null
when calling->shift()
changed with this Framework PR.This causes a problem when returning errors during validation:
https://github.com/laravel-json-api/validation/blob/2c883a5d1727cd8683deed74167956471a82272a/src/ErrorIterator.php#L115
The Elvis operator here won't fall-through to the empty array.