Fix build with PHP 8.6: unserialize_callback_func is a zend_string - #419
Open
andypost wants to merge 2 commits into
Open
Fix build with PHP 8.6: unserialize_callback_func is a zend_string#419andypost wants to merge 2 commits into
andypost wants to merge 2 commits into
Conversation
php-src commit c82acefe470 (php 8.6.0beta1) converted the PG(unserialize_callback_func) global from char* to zend_string*. Fixes igbinary#418
Covers the two cases the change touches and the existing tests miss: - An empty unserialize_callback_func. Every way of setting the ini (php.ini, -d, -c, ini_set) stores a non-NULL zero-length zend_string; only a total absence of ini leaves the global NULL. Without the length check the empty name is called, raising 'Invalid callback , function "" not found'. - A callback that reassigns unserialize_callback_func while it runs. The warning has to name the callback that was actually called.
61 tasks
eiriksm
pushed a commit
to violinist-dev/php-base
that referenced
this pull request
Aug 15, 2026
My previous sed-based fix kept a raw char* into PG(unserialize_callback_func)'s zend_string and re-read it later in the same function, after invoking arbitrary user PHP code via the unserialize callback -- if that callback reassigns unserialize_callback_func, the original zend_string can be freed, making the later read a use-after-free. igbinary/igbinary#419 already fixes this upstream (not yet merged) by taking an owned copy of the string up front. Cherry-pick that commit instead of carrying a subtly unsafe patch of our own. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012KziZyXrwQuJyZeFPm1aQ6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
php-src php/php-src@c82acefe470 (php 8.6.0beta1) converted the PG(unserialize_callback_func) global from char* to zend_string*.
Fixes #418