Add compile-time warning on invalid parent use by morrisonlevi · Pull Request #3564 · php/php-src

@morrisonlevi

This is a new attempt at fixing the issue from PR #3404.

nikic

Choose a reason for hiding this comment

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

This is no longer necessary, you can use ce->parent_name.

Choose a reason for hiding this comment

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

Thanks - will rework the patch.

Choose a reason for hiding this comment

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

@nikic How do I know if it's safe to use parent or parent_name in that union?

Choose a reason for hiding this comment

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

During compilation it should always be parent_name. Otherwise the ZEND_ACC_LINKED flag.

@morrisonlevi

@morrisonlevi

Okay, the branch is now passing travis tests. Could I get another review?

@php-pulls

Comment on behalf of petk at php.net:

Labelling

ammarfaizi2

@nikic

The changes for ::class handling here are not quite correct. If we add support for parent::class in constant expression contexts, then we also have to support it in cases where it can only be determined at runtime.

I've just fixed an existing related bug in 41af1e6.

@nikic

I have refactored the ::class handling and introduced support for resolving parent::class during runtime constexpr eval.

@nikic

I've committed the parent check as a hard error in a9e6667. I think the BC break here is both very minor and easy to fix, so going through a deprecation period is more trouble than it is worth.

jrfnl added a commit to PHPCompatibility/PHPCompatibility that referenced this pull request

Jun 14, 2019

@jrfnl jrfnl mentioned this pull request

Jun 14, 2019