Skip to content

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

Merged
LamentXU123 merged 1 commit into
php:masterfrom
lacatoire:fix/zip-entry-close-true
Aug 21, 2026
Merged

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

Conversation

@lacatoire

@lacatoire lacatoire commented Aug 20, 2026

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.

@LamentXU123

LamentXU123 commented Aug 21, 2026

Copy link
Copy Markdown
Member

However, I don't know whether it worth the break to fix this, since the zip_entry_close function is deprecated.

@lacatoire Could you remove the test added for this improvement? Otherwise it is good.

@lacatoire

Copy link
Copy Markdown
Member Author

Is there a reason you don't add tests ? I will remove those next time

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.
@lacatoire
lacatoire force-pushed the fix/zip-entry-close-true branch from a499e3e to 9f59d2f Compare August 21, 2026 13:23
@LamentXU123

Copy link
Copy Markdown
Member

This is just an improvement to the return type so doesn't warrant a test, there is little BC break anyways :)

@LamentXU123
LamentXU123 merged commit 3a710fa into php:master Aug 21, 2026
18 checks passed
@LamentXU123

Copy link
Copy Markdown
Member

Thanks!

@lacatoire
lacatoire deleted the fix/zip-entry-close-true branch August 21, 2026 14:01
LamentXU123 added a commit that referenced this pull request Aug 21, 2026
Since commit a183f11 has an UPGRADING entry, for the
sake of consistency let's also add an UPGRADING entry
for #23395
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