[php-src] PHP-8.6: Fix null handler generation for unspecialized VMs (#25579)

From: Date: Thu, 19 Nov 2026 09:47:50 +0000
Subject: [php-src] PHP-8.6: Fix null handler generation for unspecialized VMs (#25579)
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-143866@lists.php.net to get a copy of this message
Author: Weilin Du (LamentXU123) Date: 2026-11-19T17:41:06+08:00 Commit: https://github.com/php/php-src/commit/71c8684124d62c88595b7c028df9fb1a7f491d8c Raw diff: https://github.com/php/php-src/commit/71c8684124d62c88595b7c028df9fb1a7f491d8c.diff Fix null handler generation for unspecialized VMs (#25579) Fix GH-25571 by using gen_null_label() for opcode gaps and undefined opcodes in the unspecialized handler table. The previous code read an undefined $variant, raising a warning and emitting ZEND_NULL_HANDLER for TAILCALL entries that need ZEND_NULL_TAILCALL_HANDLER. Closes #25579 Changed paths: M NEWS M Zend/zend_vm_gen.php Diff: diff --git a/NEWS b/NEWS index f9aff8c17780..222fc76b3f23 100644 --- a/NEWS +++ b/NEWS @@ -29,6 +29,8 @@ PHP NEWS . Fixed object_properties_load() adding integer keys to property tables, which made the properties unreadable and clone hit an assertion. (Nicolas Grekas) + . Fixed bug GH-25571 (Incorrect null handlers when generating unspecialized + Zend VMs). (Weilin Du) - Curl: . Fixed curl_reset() retaining CURLOPT_PRIVATE after reset. (lacatoire) diff --git a/Zend/zend_vm_gen.php b/Zend/zend_vm_gen.php index 0101dc8ad628..286811027d53 100755 --- a/Zend/zend_vm_gen.php +++ b/Zend/zend_vm_gen.php @@ -1465,18 +1465,7 @@ function gen_labels($f, $spec, $kind, $prolog, &$specs, $switch_labels = array() while ($next != $num) { // If some opcode numbers are not used then fill hole with pointers // to handler of undefined opcode - switch ($kind) { - case ZEND_VM_KIND_CALL: - case ZEND_VM_KIND_TAILCALL: - out($f,$prolog."ZEND_NULL{$variant}_HANDLER,\n"); - break; - case ZEND_VM_KIND_SWITCH: - out($f,$prolog."-1,\n"); - break; - case ZEND_VM_KIND_GOTO: - out($f,$prolog."(void*)&&ZEND_NULL_LABEL,\n"); - break; - } + gen_null_label($f, $kind, $prolog); $next++; } if ($num >= 256) { @@ -1512,18 +1501,7 @@ function gen_labels($f, $spec, $kind, $prolog, &$specs, $switch_labels = array() } $list[] = $dsc["op"]; } else { - switch ($kind) { - case ZEND_VM_KIND_CALL: - case ZEND_VM_KIND_TAILCALL: - out($f,$prolog."ZEND_NULL{$variant}_HANDLER,\n"); - break; - case ZEND_VM_KIND_SWITCH: - out($f,$prolog."-1,\n"); - break; - case ZEND_VM_KIND_GOTO: - out($f,$prolog."(void*)&&ZEND_NULL_LABEL,\n"); - break; - } + gen_null_label($f, $kind, $prolog); $list[] = null; } }

« previous php.cvs (#143866) next »