File tree Expand file tree Collapse file tree 3 files changed +42
-3
lines changed Expand file tree Collapse file tree 3 files changed +42
-3
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,10 @@ PHP NEWS
11
11
- CGI:
12
12
. Fixed bug #80849 (HTTP Status header truncation). (cmb)
13
13
14
+ - Opcache:
15
+ . Fixed bug #81225 (Wrong result with pow operator with JIT enabled).
16
+ (Dmitry)
17
+
14
18
- Standard:
15
19
. Fixed bug #72146 (Integer overflow on substr_replace). (cmb)
16
20
. Fixed bug #81265 (getimagesize returns 0 for 256px ICO images).
Original file line number Diff line number Diff line change @@ -4274,17 +4274,20 @@ static int zend_jit_math_long_long(dasm_State **Dst,
4274
4274
} else if (opcode == ZEND_ADD &&
4275
4275
!may_overflow &&
4276
4276
Z_MODE(op1_addr) == IS_REG &&
4277
- Z_MODE(op2_addr) == IS_CONST_ZVAL) {
4277
+ Z_MODE(op2_addr) == IS_CONST_ZVAL &&
4278
+ IS_SIGNED_32BIT(Z_LVAL_P(Z_ZV(op2_addr)))) {
4278
4279
| lea Ra(result_reg), [Ra(Z_REG(op1_addr))+Z_LVAL_P(Z_ZV(op2_addr))]
4279
4280
} else if (opcode == ZEND_ADD &&
4280
4281
!may_overflow &&
4281
4282
Z_MODE(op2_addr) == IS_REG &&
4282
- Z_MODE(op1_addr) == IS_CONST_ZVAL) {
4283
+ Z_MODE(op1_addr) == IS_CONST_ZVAL &&
4284
+ IS_SIGNED_32BIT(Z_LVAL_P(Z_ZV(op1_addr)))) {
4283
4285
| lea Ra(result_reg), [Ra(Z_REG(op2_addr))+Z_LVAL_P(Z_ZV(op1_addr))]
4284
4286
} else if (opcode == ZEND_SUB &&
4285
4287
!may_overflow &&
4286
4288
Z_MODE(op1_addr) == IS_REG &&
4287
- Z_MODE(op2_addr) == IS_CONST_ZVAL) {
4289
+ Z_MODE(op2_addr) == IS_CONST_ZVAL &&
4290
+ IS_SIGNED_32BIT(Z_LVAL_P(Z_ZV(op2_addr)))) {
4288
4291
| lea Ra(result_reg), [Ra(Z_REG(op1_addr))-Z_LVAL_P(Z_ZV(op2_addr))]
4289
4292
} else {
4290
4293
| GET_ZVAL_LVAL result_reg, op1_addr
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #81225: Wrong result with pow operator with JIT enabled
3
+ --INI--
4
+ opcache.enable=1
5
+ opcache.enable_cli=1
6
+ opcache.jit_buffer_size=1M
7
+ opcache.jit=tracing
8
+ --SKIPIF--
9
+ <?php require_once ('skipif.inc ' ); ?>
10
+ --FILE--
11
+ <?php
12
+
13
+ function unsignedLong (int $ offset ): int
14
+ {
15
+ $ normalizedOffset = $ offset % (2 ** 32 );
16
+
17
+ if ($ normalizedOffset < 0 ) {
18
+ $ normalizedOffset += 2 ** 32 ;
19
+ }
20
+
21
+ return $ normalizedOffset ;
22
+ }
23
+
24
+ $ offset = -0x100000000 + 2 ;
25
+
26
+ for ($ i = 0 ; $ i < 200 ; ++$ i ) {
27
+ assert (unsignedLong ($ offset ) === 2 );
28
+ }
29
+ ?>
30
+ OK
31
+ --EXPECT--
32
+ OK
You can’t perform that action at this time.
0 commit comments