Skip to content

Fix crash in hooked iterator on properties array without dynamic properties #15394

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

Merged
merged 1 commit into from
Aug 19, 2024

Conversation

iluuu1994
Copy link
Member

Also fix incorrect usage of zend_read_property_ex().

Fixes GH-15187

@iluuu1994
Copy link
Member Author

iluuu1994 commented Aug 13, 2024

Actually, there's another issue:

class Test {
    public int $prop { set => $value; }
}

$test = new Test();
var_dump($test);
foreach ($test as $key => $value) {
    var_dump($key, $value);
}

This currently prints NULL, but the property should be skipped instead... I'll have a look tomorrow.

@iluuu1994
Copy link
Member Author

Ok, both issues should be fixed now. I changed the implementation to set data/key to null on reset/forward, and fetch the data (if it wasn't already) on valid/get_current_data. Fetching the data includes moving forward further if the data is unavailable, both for declared and dynamic properties.

Copy link
Member

@arnaud-lb arnaud-lb left a comment

Choose a reason for hiding this comment

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

Looks good to me apart from one comment

@iluuu1994 iluuu1994 merged commit 60f87f2 into php:master Aug 19, 2024
8 of 10 checks passed
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.

Segmentation fault (access illegal address) in zend allocator
2 participants