[php-src] PR #25701: Fix use-after-free when the error handler releases the assignment target

From: Date: Tue, 24 Nov 2026 11:15:21 +0000
Subject: [php-src] PR #25701: Fix use-after-free when the error handler releases the assignment target
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-40948@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/25701 Author: jorgsowa An error handler for "Undefined variable" on the assigned value can free or modify the array or object being written to. The engine still holds a pointer into it. This is what breaks assign_dim_undef_op_data_008.phpt on the nightly MSAN and PPC64 ASAN builds (#24665). VM (commit 1) — on its own this fixes the nightly builds, which run without JIT: - ASSIGN_DIM / ASSIGN_DIM_OP: hold the array across the warning, and skip the write if the handler destroyed or shared it. This matches zend_undefined_offset_write(). - ASSIGN_OBJ / ASSIGN_OBJ_OP with a fetched container ($a[0]->p = $undef): copy the container into the instruction's own slot before the warning. JIT (commit 2): - Function JIT hands ASSIGN_OBJ to the VM when the value may be undefined. - Tracing JIT exits to the VM when the value is undefined. - The typed-reference assignment helpers hold the reference across the warning.

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