Skip to content

Commit 6ab36fb

Browse files
committed
JIT: Fixed incorrect reference handling in PRE_INC/DEC_OBJ
1 parent cd45bd0 commit 6ab36fb

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

ext/opcache/jit/zend_jit_helpers.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2367,12 +2367,14 @@ static void ZEND_FASTCALL zend_jit_dec_typed_prop(zval *var_ptr, zend_property_i
23672367

23682368
static void ZEND_FASTCALL zend_jit_pre_inc_typed_prop(zval *var_ptr, zend_property_info *prop_info, zval *result)
23692369
{
2370+
ZVAL_DEREF(var_ptr);
23702371
zend_jit_inc_typed_prop(var_ptr, prop_info);
23712372
ZVAL_COPY(result, var_ptr);
23722373
}
23732374

23742375
static void ZEND_FASTCALL zend_jit_pre_dec_typed_prop(zval *var_ptr, zend_property_info *prop_info, zval *result)
23752376
{
2377+
ZVAL_DEREF(var_ptr);
23762378
zend_jit_dec_typed_prop(var_ptr, prop_info);
23772379
ZVAL_COPY(result, var_ptr);
23782380
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--TEST--
2+
PRE_INC_OBJ: 003
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.file_update_protection=0
7+
opcache.jit_buffer_size=1M
8+
opcache.protect_memory=1
9+
--FILE--
10+
<?php
11+
class Test {
12+
public float $prop = 1.0;
13+
}
14+
$test = new Test;
15+
$r = &$test->prop;
16+
$v = --$test->prop;
17+
var_dump($v);
18+
?>
19+
--EXPECT--
20+
float(0)

0 commit comments

Comments
 (0)