[php-src] PR #25804: Zend: Fix GH-25700 and GH-25706: Destructor sees the value being replaced by a hash update
| From: | Roman3349 | Date: | Thu, 26 Nov 2026 21:26:43 +0000 |
| Subject: | [php-src] PR #25804: Zend: Fix GH-25700 and GH-25706: Destructor sees the value being replaced by a hash update | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-41078@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/25804
Author: Roman3349
When an existing value is replaced, _zend_hash_add_or_update_i() and its str and index variants
destroy the old value before storing the new one, so a destructor running from it still finds the
old value in the table. Store the new value first and destroy the old one afterwards, as
zend_hash_del() already does. zend_hash_str_del_ind() now uses the same order as
zend_hash_del_ind().
The auto-global callbacks also added the PG(http_globals) reference only after zend_hash_update(),
so a destructor that unset or replaced $_ENV or $_SERVER freed the new array. Add the reference
first.
Fixes GH-25700
Fixes GH-25706