Skip to content

Conversation

@alexandre-daubois
Copy link
Member

Fix #19406

The PR only focuses on constants, the other failing cases seem to be fixed already. I targeted 8.4 because of what's been mentioned in the issue.

Copy link
Member

@iluuu1994 iluuu1994 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is the right solution. It allows accessing protected constants on any "cousin" class. E.g.

class P {}

class C1 extends P {
    protected const C = 'C1';
}

class C2 extends P {
    public static function test() {
        var_dump(C1::C);
    }
}

C2::test();
// string(2) "C1"

The same does not apply to properties. Time complexity is also not great, as zend_check_protected() itself has two loops, giving us O(n²).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants