Skip to content

ext/zip: Change return type of zip_entry_close() to true - #23395

Open
lacatoire wants to merge 1 commit into
php:masterfrom
lacatoire:fix/zip-entry-close-true
Open

ext/zip: Change return type of zip_entry_close() to true#23395
lacatoire wants to merge 1 commit into
php:masterfrom
lacatoire:fix/zip-entry-close-true

Conversation

@lacatoire

Copy link
Copy Markdown
Member

zip_entry_close() is declared bool, but it has no failing return: invalid arguments and resources that are not zip entries throw, and zend_list_close() returns void, so the function always ends on RETURN_TRUE.

zip_entry_open() is deliberately left alone: it ends on RETURN_BOOL(zr_rsrc->zf != NULL), which can genuinely be false, so bool is right there. zip_close() is already void.

true being a subtype of bool, the only observable change is what Reflection reports. The added test pins both return types so the distinction is not flattened later.

The function has two exits: RETURN_THROWS for a bad parameter or a
stale resource, and an unconditional RETURN_TRUE after closing the
entry. Nothing returns false.
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.

1 participant