Skip to content

Commit 9ce388b

Browse files
committed
JIT: Fixed missed zval type initialization
1 parent 7d48341 commit 9ce388b

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13528,30 +13528,38 @@ static int zend_jit_incdec_obj(dasm_State **Dst,
1352813528
|.if X64
1352913529
| mov64 rax, 0x43e0000000000000
1353013530
| SET_ZVAL_LVAL var_addr, rax
13531+
| SET_ZVAL_TYPE_INFO var_addr, IS_DOUBLE
1353113532
if (opline->opcode == ZEND_PRE_INC_OBJ && opline->result_type != IS_UNUSED) {
1353213533
| SET_ZVAL_LVAL res_addr, rax
13534+
| SET_ZVAL_TYPE_INFO res_addr, IS_DOUBLE
1353313535
}
1353413536
|.else
1353513537
| SET_ZVAL_LVAL var_addr, 0
1353613538
| SET_ZVAL_W2 var_addr, 0x41e00000
13539+
| SET_ZVAL_TYPE_INFO var_addr, IS_DOUBLE
1353713540
if (opline->opcode == ZEND_PRE_INC_OBJ && opline->result_type != IS_UNUSED) {
1353813541
| SET_ZVAL_LVAL res_addr, 0
1353913542
| SET_ZVAL_W2 res_addr, 0x41e00000
13543+
| SET_ZVAL_TYPE_INFO res_addr, IS_DOUBLE
1354013544
}
1354113545
|.endif
1354213546
} else {
1354313547
|.if X64
1354413548
| mov64 rax, 0xc3e0000000000000
1354513549
| SET_ZVAL_LVAL var_addr, rax
13550+
| SET_ZVAL_TYPE_INFO var_addr, IS_DOUBLE
1354613551
if (opline->opcode == ZEND_PRE_DEC_OBJ && opline->result_type != IS_UNUSED) {
1354713552
| SET_ZVAL_LVAL res_addr, rax
13553+
| SET_ZVAL_TYPE_INFO res_addr, IS_DOUBLE
1354813554
}
1354913555
|.else
1355013556
| SET_ZVAL_LVAL var_addr, 0x00200000
1355113557
| SET_ZVAL_W2 var_addr, 0xc1e00000
13558+
| SET_ZVAL_TYPE_INFO var_addr, IS_DOUBLE
1355213559
if (opline->opcode == ZEND_PRE_DEC_OBJ && opline->result_type != IS_UNUSED) {
1355313560
| SET_ZVAL_LVAL res_addr, 0x00200000
1355413561
| SET_ZVAL_W2 res_addr, 0xc1e00000
13562+
| SET_ZVAL_TYPE_INFO res_addr, IS_DOUBLE
1355513563
}
1355613564
|.endif
1355713565
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
--TEST--
2+
PRE_INC_OBJ: 001
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+
opcache.jit=function
10+
--FILE--
11+
<?php
12+
class Test {
13+
public $prop;
14+
function foo() {
15+
$this->prop = PHP_INT_MAX - 5;
16+
for ($i = 0; $i < 10; $i++) {
17+
var_dump(++$this->prop);
18+
}
19+
}
20+
}
21+
22+
$test = new Test;
23+
$test->foo();
24+
?>
25+
--EXPECTF--
26+
int(%d)
27+
int(%d)
28+
int(%d)
29+
int(%d)
30+
int(%d)
31+
float(%f)
32+
float(%f)
33+
float(%f)
34+
float(%f)
35+
float(%f)

0 commit comments

Comments
 (0)