You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This may be entirely to do with some oddity of the project where I'm trying to switch to Zttp (Lumen v5.1.7, due to requirements back when it was built and lack of time/resources to rework it in 5.5 or full Laravel), but the changes in runBeforeSendingCallbacks in commit 7b6dddc throw an error for me on any request, including a simple get with no parameters:
PHP error: Undefined property: Illuminate\Support\Collection::$each in [...]/vendor/kitetail/zttp/src/Zttp.php on line 178
Using kitetail/zttp v0.3.0 and illuminate/support v5.1.41.
Illuminate\Support\Collection definitely has the each function, but I'm probably in over my head as to what I'm doing wrong. If I switch back to array_reduce and [] instead of collect(), there are no errors and the call behaves as expected. Any idea what I'm running up against? Again, fully expecting it to be something on my end (and I'm not expecting help with that) with the older Lumen/Illuminate versions in play rather than a Zttp issue, but I figured I could check.
The text was updated successfully, but these errors were encountered:
I bet this is because we use the collect helper function and Lumen already has it defined so we are getting an old version of the Collection class. Not at my computer right now but I'll double check this when I get home 👍🏻
I'm going to rename this issue to match the root cause and will think if there's a good interim solution.
adamwathan
changed the title
runbeforeSendingCallbacks errors on undefined each
Doesn't work with older versions of Laravel due to Collection namespace collision
Sep 14, 2017
I ran into this on a pretty blank API project that had laravel/tinker in its dependencies. Tinker apparently installed illuminate/support v 5.2.x when depending on the latest tinker.
This may be entirely to do with some oddity of the project where I'm trying to switch to Zttp (Lumen v5.1.7, due to requirements back when it was built and lack of time/resources to rework it in 5.5 or full Laravel), but the changes in runBeforeSendingCallbacks in commit 7b6dddc throw an error for me on any request, including a simple get with no parameters:
Using kitetail/zttp v0.3.0 and illuminate/support v5.1.41.
Illuminate\Support\Collection definitely has the each function, but I'm probably in over my head as to what I'm doing wrong. If I switch back to array_reduce and [] instead of collect(), there are no errors and the call behaves as expected. Any idea what I'm running up against? Again, fully expecting it to be something on my end (and I'm not expecting help with that) with the older Lumen/Illuminate versions in play rather than a Zttp issue, but I figured I could check.
The text was updated successfully, but these errors were encountered: