Skip to content

Conversation

@nielsdos
Copy link
Member

If object initialization fails the zval will be NULL, that's an implementation detail. However, it's very confusing for a reader to destroy a seemingly uninitialized zval.

If object initialization fails the zval will be NULL, that's an
implementation detail. However, it's very confusing for a reader to
destroy a seemingly uninitialized zval.
Copy link
Member

@devnexen devnexen left a comment

Choose a reason for hiding this comment

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

you seem to have forgotten to add yourself as code owner :)

@nielsdos nielsdos merged commit 29d6e29 into php:master Oct 12, 2025
10 checks passed
Comment on lines 1747 to 1754
if (SUCCESS != object_init_ex(&iteriter, spl_ce_RecursiveIteratorIterator)) {
zval_ptr_dtor(&iter);
zval_ptr_dtor(&iteriter);
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Unable to instantiate directory iterator for %s", phar_obj->archive->fname);
RETURN_THROWS();
}

zend_call_known_instance_method_with_1_params(spl_ce_RecursiveIteratorIterator->constructor,
Z_OBJ(iteriter), NULL, &iter);
Copy link
Member

Choose a reason for hiding this comment

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

Follow-up idea maybe use the newish object_init_with_constructor() API? (and similarly for the above case)

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes: #20156

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.

3 participants