-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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
8.3 - as final trait-used method does not correctly report visibility in Reflection #12854
Comments
This should error, as combining final and private are a usually illegal combination. It seems the visibility flags aren't correctly initialized at all.
|
Yeah, as I'm saying in the original post:
But reflection lies for |
The problem, and similar for the other issue, is that the following code makes an assumption that if any modifier is set it is always the PPP mask: I think instead something like this is desirable: if (alias->modifiers & ZEND_ACC_PPP_MASK) {
fn_copy.common.fn_flags = alias->modifiers | (fn->common.fn_flags & ~ZEND_ACC_PPP_MASK);
} else {
fn_copy.common.fn_flags = alias->modifiers | fn->common.fn_flags;
} In this case if a visibility modifier is set we always take those (and other flags) from the modifier. To make it error out we additionally need a check like |
…report visibility in Reflection
* PHP-8.3: Fix GH-12854: 8.3 - as final trait-used method does not correctly report visibility in Reflection
Hey, there's a new bug in PHP 8.3.2 because of this behaviour: https://3v4l.org/VIEcd I'm gonna open a new bug report about this, just wanted to inform you. |
Description
The following code:
Resulted in this output:
But I expected this output instead:
Alternatively, a syntax resulting in "final private" class method should be rejected because normally they're not allowed.
But the same bug applies to "protected" method -
isProtected
in ReflectionMethod is alsofalse
: https://3v4l.org/0PZvm#v8.3.0PHP Version
PHP 8.3
Operating System
No response
The text was updated successfully, but these errors were encountered: