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
Allow inherited magic method to still run with calling class #3719
Conversation
If a static method cannot be resolved to the calling class, but the calling class has, or inherits, a `__callStatic` handler, this allows the `__callStatic` handler to be used with the calling class, and not the inherited class as would occur with reflection. This allows systems such as Laravel facades to still work. Fixes twigphp#3716
If this fix is acceptable, I'm happy to do a PR to the |
@bennothommo are you able to add the test case that fails before this change and passes after too? |
@LukeTowers if you mean my original test patch, that works irrespective of this fix. The issue only manifests when rendering the template. I'm not sure where to put that into a test. |
@stof @nicolas-grekas any guidance on tests for this PR? |
We do have integration tests that render templates |
Found them - thanks @stof. |
Temporary fix while waiting for twigphp/Twig#3719 to be merged.
Thanks for the PR. I've ported it to #3722 |
…s (bennothommo) This PR was merged into the 2.x branch. Discussion ---------- Allow inherited magic method to still run with calling class This is #3719 ported to 2.x and improved a bit. I also reported php/php-src#8932 because the underlying behavior of PHP is broken to me. If a static method cannot be resolved to the calling class, but the calling class has, or inherits, a `__callStatic` handler, this allows the `__callStatic` handler to be used with the calling class, and not the inherited class as would occur with reflection. This allows systems such as Laravel facades to still work. Fixes #3716 Commits ------- d1457a4 Allow inherited magic method to still run with calling class
If a static method cannot be resolved to the calling class, but the calling class has, or inherits, a
__callStatic
handler, this allows the__callStatic
handler to be used with the calling class, and not the inherited class as would occur with reflection. This allows systems such as Laravel facades to still work.Fixes #3716