Skip to content

Conversation

nielsdos
Copy link
Member

phar_metadata_tracker_unserialize_or_copy() is only ever preceded by phar_metadata_tracker_has_data() which won't throw. This check is quite hacky and it should always be the responsibility of the caller to avoid calling this, even the comment acknowledges this is a hack.

phar_metadata_tracker_unserialize_or_copy() is only ever preceded by
phar_metadata_tracker_has_data() which won't throw.
This check is quite hacky and it should always be the responsibility of
the caller to avoid calling this, even the comment acknowledges this is
a hack.
@nielsdos nielsdos changed the title phar: Change hacky check into an exception phar: Change hacky check into an assertion Oct 13, 2025
const bool has_unserialize_options = unserialize_options != NULL && zend_hash_num_elements(unserialize_options) > 0;
/* It should be impossible to create a zval in a persistent phar/entry. */
ZEND_ASSERT(!persistent || Z_ISUNDEF(tracker->val));
ZEND_ASSERT(!EG(exception));
Copy link
Member

Choose a reason for hiding this comment

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

nit: I would not mind a comment.

@nielsdos nielsdos merged commit 44aea65 into php:master Oct 14, 2025
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.

2 participants