Skip to content

Do not close foreign resources in mailparse_msg_free() - #77

Closed
iliaal wants to merge 1 commit into
php:masterfrom
iliaal:fix-msg-free-foreign-resource
Closed

iliaal wants to merge 1 commit into
php:masterfrom
iliaal:fix-msg-free-foreign-resource

Conversation

@iliaal

@iliaal iliaal commented Oct 31, 2026

Copy link
Copy Markdown
Member

mailparse_msg_free() handed any resource to zend_list_close(), so mailparse_msg_free($stream) closed the stream. It now fetches the resource as a mailparse message like the other mailparse_msg_*() functions, so a foreign resource raises a TypeError (a warning on PHP 7), and it still returns true for a handle that was already freed. Depends on #75; only the last commit is new here.

@remicollet

Copy link
Copy Markdown
Member

Please rebase after #75

mailparse_msg_free() passed any resource to zend_list_close(), so
mailparse_msg_free($stream) closed the stream. Fetch the resource as a
mailparse message first, as the other mailparse_msg_*() functions do. An
already closed resource still returns true.
@iliaal
iliaal force-pushed the fix-msg-free-foreign-resource branch from 750ab7d to e42b4fb Compare November 6, 2026 13:20
@iliaal

iliaal commented Nov 6, 2026

Copy link
Copy Markdown
Member Author

Rebased

@remicollet

Copy link
Copy Markdown
Member

Ammended (package.xml) and merged
Thanks

@remicollet remicollet closed this Nov 6, 2026
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