Allow inherited magic method to still run with calling class#3719
Closed
bennothommo wants to merge 2 commits intotwigphp:3.xfrom
Closed
Allow inherited magic method to still run with calling class#3719bennothommo wants to merge 2 commits intotwigphp:3.xfrom
bennothommo wants to merge 2 commits intotwigphp:3.xfrom
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
Contributor
Author
|
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? |
Contributor
Author
|
@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? |
Member
|
We do have integration tests that render templates |
Contributor
Author
|
Found them - thanks @stof. |
LukeTowers
pushed a commit
to wintercms/storm
that referenced
this pull request
Jul 5, 2022
Temporary fix while waiting for twigphp/Twig#3719 to be merged.
Contributor
|
Thanks for the PR. I've ported it to #3722 |
fabpot
added a commit
that referenced
this pull request
Aug 12, 2022
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If a static method cannot be resolved to the calling class, but the calling class has, or inherits, a
__callStatichandler, this allows the__callStatichandler 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