You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
8.3 - as final trait-used method does not correctly report visibility in Reflection #12854
This should error, as combining final and private are a usually illegal combination. It seems the visibility flags aren't correctly initialized at all.
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: fn_copy.common.fn_flags = alias->modifiers | (fn->common.fn_flags & ~ZEND_ACC_PPP_MASK);
In this case if a visibility modifier is set we always take those (and other flags) from the modifier.
If it is not set we don't remove the visibility from fn_flags but instead just add the modifiers on top.
To make it error out we additionally need a check like if ((fn->common.fn_flags & ZEND_ACC_PRIVATE) && (fn->common.fn_flags & ZEND_ACC_FINAL)) somewhere.
Activity
iluuu1994 commentedon Dec 2, 2023
This should error, as combining final and private are a usually illegal combination. It seems the visibility flags aren't correctly initialized at all.
https://3v4l.org/UIrg1#v8.3.0
ondrejmirtes commentedon Dec 2, 2023
Yeah, as I'm saying in the original post:
But reflection lies for
protectedtoo: https://3v4l.org/0PZvm#v8.3.0ndossche commentedon Dec 3, 2023
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:
fn_copy.common.fn_flags = alias->modifiers | (fn->common.fn_flags & ~ZEND_ACC_PPP_MASK);I think instead something like this is desirable:
In this case if a visibility modifier is set we always take those (and other flags) from the modifier.
If it is not set we don't remove the visibility from fn_flags but instead just add the modifiers on top.
To make it error out we additionally need a check like
if ((fn->common.fn_flags & ZEND_ACC_PRIVATE) && (fn->common.fn_flags & ZEND_ACC_FINAL))somewhere.Fix phpGH-12854: 8.3 - as final trait-used method does not correctly …
Fix GH-12854: 8.3 - as final trait-used method does not correctly rep…
Merge branch 'PHP-8.3'
ondrejmirtes commentedon Jan 17, 2024
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.