Skip to content

Fix assertion failure in zend_std_read_property #16639

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

Closed
wants to merge 1 commit into from

Conversation

arnaud-lb
Copy link
Member

Fixes GH-16615.

We assert that Z_PROP_FLAG_P(retval) is exactly IS_PROP_UNINIT, but this is a bit field and it may contain irrelevant bits. For instance, props may also have the IS_PROP_LAZY or IS_PROP_REINITABLE bits, which does not change the fact that the property is uninitialized:

<?php

class Foo {
    public string $bar {
        set => $value;
    }
    public function __clone() {
        // Assertion failure
        echo $this->bar;
    }
}

clone new Foo();

@nielsdos I didn't update the comment because it's still correct, and I think that using equality comparison was unintended.

@arnaud-lb arnaud-lb changed the base branch from master to PHP-8.4 October 29, 2024 12:26
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.

Ah, silly mistake on my part. Thank you!

@arnaud-lb arnaud-lb closed this in 3d3b22d Oct 30, 2024
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.

Hooked properties combined with lazy ghosts cause an assertion failure
3 participants