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
Extending Collection causes infinite loop #17483
Comments
Looks like that assumes Collection. I'm not a big fan of these traits, but think we can fix this. |
Extending Collection outside of cake is not possible because we have logic that work sonly for Because |
Well, that's unfortunate. :-( I'll have to try to think of a way to encapsulate it instead of extending, I guess. The class should probably be marked as |
We have to change the iterators to not extend Collection to mark it final. Will keep this open while we look into if the interfaces or inheritance can change in 5.1. |
This issue is stale because it has been open for 120 days with no activity. Remove the |
Description
Original Thread: https://discourse.cakephp.org/t/extended-collection-class-not-behaving-the-same-as-base-collection-class/11734
As can be seen in the mentioned forum link (thanks @Zuluru) if one extends a collection it behaves differently (in this specific case it causes an infinite loop)
I'll just copy/paste the example in here:
if you change
new MyCollection
tonew Collection
it works just fine.My guess is related to this line: https://github.com/cakephp/cakephp/blob/5.x/src/Collection/CollectionTrait.php#L937
But I don't use collections and have not yet doven into this black magic.
CakePHP Version
5.0.3
PHP Version
8.2
The text was updated successfully, but these errors were encountered: