[php-src] PR #22471: Keep dumped objects alive across __debugInfo() and property hooks

From: Date: Fri, 26 Jun 2026 13:41:00 +0000
Subject: [php-src] PR #22471: Keep dumped objects alive across __debugInfo() and property hooks
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-36673@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/22471 Author: iliaal var_dump() and debug_zval_dump() can use-after-free an object when its __debugInfo() triggers a user error handler that frees the object, for example by nulling a reference that aliases the dumped array slot. Both functions hold a raw pointer to the object across the __debugInfo() call and read its class name, handle and properties afterwards. Fix: hold a reference on the object across zend_get_properties_for() and read its identity through the captured zend_object pointer rather than the zval, releasing the reference after the dump. debug_zval_dump() reports the refcount without the temporary reference. This crashes with a plain synchronous handler, independent of any error-handler timing change.

« previous php.git-pulls (#36673) next »