[GIT-PULLS] [php-src] PR #22919: Free the hooked property value when json_encode() sees an exception

[email protected] (iliaal) Wed, 29 Jul 2026 12:49:35 +0000
Newsgroups php.git-pulls
Message-ID <[email protected]>
Pull Request: https://github.com/php/php-src/pull/22919
Author: iliaal

A get hook can publish its return value into the zval json_encode() handed to zend_read_property_ex(), then throw while the engine tears the hook's frame down, for instance from the destructor of one of its locals. php_json_encode_array() returns on EG(exception) without destroying that zval, so the value survives to request shutdown. Twenty encodes of a hook returning a 1 MiB string retain 21 MB before the patch, 1.5 KB after.