Skip to content

Fix GH-19397: mb_list_encodings() can cause crashes on shutdown #19405

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

nielsdos
Copy link
Member

@nielsdos nielsdos commented Aug 7, 2025

The request shutdown does not necessarily hold the last reference, if there is still a CV that refers to the array.

The request shutdown does not necessarily hold the last reference, if
there is still a CV that refers to the array.
Copy link
Contributor

@youkidearitai youkidearitai left a comment

Choose a reason for hiding this comment

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

Thank you, Looks good to me.

if (GC_DELREF(MBSTRG(all_encodings_list)) == 0) {
/* must be *array* destroy to remove from GC root buffer and free the hashtable itself */
zend_array_destroy(MBSTRG(all_encodings_list));
}
Copy link
Member

Choose a reason for hiding this comment

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

Could use zend_array_release?

Copy link
Member Author

Choose a reason for hiding this comment

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

Wanted to avoid the immutability check, but sure

Copy link
Member Author

Choose a reason for hiding this comment

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

In fact that's what I proposed initially #19397 (comment)

Copy link
Contributor

@youkidearitai youkidearitai left a comment

Choose a reason for hiding this comment

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

At least, My environment is nothing wrong. LGTM.

@nielsdos nielsdos closed this in cc93bbb Aug 8, 2025
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.

mb_list_encodings() can cause crashes on shutdown
3 participants