Example here: https://github.com/themrwilliams/cakephp-lazyload/commit/185aa5a4befb3b4a3e016ea79d5bb9a6894d4c2d Both tests are the same scenario. The first one, with the trait disabled, passes. The second one fails. I plan to dig into it more when I have time, but opening this for now in case someone has already run into a similar issue before. EDIT: This does seem to apply to any of the by-reference array functions (e.g. `array_pop`, etc.).