Skip to content

Allow inherited magic method to still run with calling class#3722

Merged
fabpot merged 1 commit intotwigphp:2.xfrom
nicolas-grekas:fix-call-static
Aug 12, 2022
Merged

Allow inherited magic method to still run with calling class#3722
fabpot merged 1 commit intotwigphp:2.xfrom
nicolas-grekas:fix-call-static

Conversation

@nicolas-grekas
Copy link
Copy Markdown
Contributor

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

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
@fabpot
Copy link
Copy Markdown
Contributor

fabpot commented Aug 12, 2022

Thank you @nicolas-grekas.

@fabpot fabpot merged commit 2528306 into twigphp:2.x Aug 12, 2022
@nicolas-grekas nicolas-grekas deleted the fix-call-static branch December 2, 2022 10:34
fabpot added a commit that referenced this pull request Dec 13, 2022
This PR was merged into the 2.x branch.

Discussion
----------

Fix optimizing closures callbacks

Follows #3722 and php/php-src#8932

Uses a dedicated method added to PHP 8.1.11 (and 8.0.24, but I feel like there is no need to make the check too complex for an outdated version. We just need a marker to make the code simpler when we'll bump to PHP >= 8.1.11.)

Commits
-------

406b3e5 Fix optimizing closures callbacks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants