1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Merge branch 'PHP-8.3'

* PHP-8.3:
  Fixed incorrect elimination of refcounted check in JIT for BIND_GLOBAL
This commit is contained in:
Dmitry Stogov
2023-12-18 11:31:45 +03:00
2 changed files with 20 additions and 3 deletions

View File

@@ -10915,7 +10915,7 @@ static int zend_jit_bind_global(zend_jit_ctx *jit, const zend_op *opline, uint32
if (op1_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF)) {
ir_ref if_refcounted = IR_UNUSED, refcount, if_non_zero, if_may_not_leak;
if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF) - (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF) - (MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
// JIT: if (UNEXPECTED(Z_REFCOUNTED_P(variable_ptr)))
if_refcounted = jit_if_REFCOUNTED(jit, op1_addr);
ir_IF_TRUE_cold(if_refcounted);
@@ -10949,13 +10949,13 @@ static int zend_jit_bind_global(zend_jit_ctx *jit, const zend_op *opline, uint32
ir_IF_FALSE(if_may_not_leak);
ir_CALL_1(IR_VOID, ir_CONST_FC_FUNC(gc_possible_root), ref2);
}
if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF) - (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF) - (MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
ir_END_list(end_inputs);
ir_IF_FALSE(if_refcounted);
}
}
if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF) - (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF) - (MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
// JIT: ZVAL_REF(variable_ptr, ref)
jit_set_Z_PTR(jit, op1_addr, ref);
jit_set_Z_TYPE_INFO(jit, op1_addr, IS_REFERENCE_EX);

View File

@@ -0,0 +1,17 @@
--TEST--
Bind global and immutable string
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.file_update_protection=0
opcache.jit_buffer_size=1M
--FILE--
<?php
function foo($a = '') {
global $a;
}
foo();
var_dump($a);
?>
--EXPECT--
NULL