[php-src] PR #22919: Free the hooked property value when json_encode() sees an exception
| From: | iliaal | Date: | Wed, 29 Jul 2026 12:49:35 +0000 |
| Subject: | [php-src] PR #22919: Free the hooked property value when json_encode() sees an exception | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-37331@lists.php.net to get a copy of this message | ||
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.