Skip to content

Fix ReflectionClass::getConstants() stub #6557

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 3 commits into from

Conversation

cmb69
Copy link
Member

@cmb69 cmb69 commented Dec 31, 2020

No description provided.

@nikic
Copy link
Member

nikic commented Dec 31, 2020

Replace

zend_array_destroy(Z_ARRVAL_P(return_value));
RETURN_NULL();
with RETURN_THROWS to make correctness of this change more obvious?

@cmb69
Copy link
Member Author

cmb69 commented Dec 31, 2020

Ugh, now I wonder whether this change is even correct. :/

@@ -4447,7 +4447,7 @@ ZEND_METHOD(ReflectionClass, getConstants)
ZEND_HASH_FOREACH_STR_KEY_PTR(&ce->constants_table, key, constant) {
if (UNEXPECTED(zval_update_constant_ex(&constant->value, ce) != SUCCESS)) {
zend_array_destroy(Z_ARRVAL_P(return_value));
Copy link
Member

Choose a reason for hiding this comment

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

You also need to drop the zend_array_destroy, otherwise there will be a double free.

@php-pulls php-pulls closed this in 82f9e00 Jan 1, 2021
@cmb69 cmb69 deleted the cmb/reflection-stub branch January 1, 2021 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants