[php-src] master: Merge branch 'PHP-8.6'

From: Date: Fri, 09 Oct 2026 16:51:58 +0000
Subject: [php-src] master: Merge branch 'PHP-8.6'
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-142127@lists.php.net to get a copy of this message
Author: ndossche (ndossche) Date: 2026-10-09T18:51:43+02:00 Commit: https://github.com/php/php-src/commit/35a74ed3fdf91dfff13c9c14d2c82b74eda84316 Raw diff: https://github.com/php/php-src/commit/35a74ed3fdf91dfff13c9c14d2c82b74eda84316.diff Merge branch 'PHP-8.6' * PHP-8.6: Fix GH-24218: Invalid opcode for count() of a literal array without SCCP Changed paths: A ext/opcache/tests/gh24218.phpt M Zend/zend_vm_def.h M Zend/zend_vm_execute.h Diff: diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 19fa358cb54c..a280d35b953c 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -9659,7 +9659,7 @@ ZEND_VM_COLD_CONST_HANDLER(190, ZEND_COUNT, CONST|TMP|CV, UNUSED) ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION(); } -ZEND_VM_TYPE_SPEC_HANDLER(ZEND_COUNT, (op1_info & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_REF)) == MAY_BE_ARRAY, ZEND_COUNT_ARRAY, CV|TMP, UNUSED) +ZEND_VM_TYPE_SPEC_HANDLER(ZEND_COUNT, op->op1_type != IS_CONST && (op1_info & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_REF)) == MAY_BE_ARRAY, ZEND_COUNT_ARRAY, CV|TMP, UNUSED) { USE_OPLINE zend_array *ht = Z_ARRVAL_P(GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R)); diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 8ab294f24c38..bf8734881c39 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -123708,8 +123708,13 @@ ZEND_API void ZEND_FASTCALL zend_vm_set_opcode_handler_ex(zend_op* op, uint32_t } break; case ZEND_COUNT: +<<<<<<< HEAD if ((op1_info & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_REF)) == MAY_BE_ARRAY) { spec = 2571 | SPEC_RULE_OP1; +======= + if (op->op1_type != IS_CONST && (op1_info & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_REF)) == MAY_BE_ARRAY) { + spec = 2580 | SPEC_RULE_OP1; +>>>>>>> PHP-8.5 } break; case ZEND_BW_OR: diff --git a/ext/opcache/tests/gh24218.phpt b/ext/opcache/tests/gh24218.phpt new file mode 100644 index 000000000000..0e5721376bec --- /dev/null +++ b/ext/opcache/tests/gh24218.phpt @@ -0,0 +1,17 @@ +--TEST-- +GH-24218 (Invalid opcode for count() of a literal array when SCCP is disabled) +--EXTENSIONS-- +opcache +--INI-- +opcache.enable_cli=1 +opcache.optimization_level=0x60 +--FILE-- +<?php + +var_dump(count([1])); +var_dump(count([1, 2, 3])); + +?> +--EXPECT-- +int(1) +int(3)

« previous php.cvs (#142127) next »