Skip to content

Commit fb582f4

Browse files
committed
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0: JIT: Fixed reference-counting inference
2 parents 9de4eb9 + 292d76d commit fb582f4

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

Zend/Optimizer/zend_inference.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2211,7 +2211,7 @@ static uint32_t binary_op_result_type(
22112211
case ZEND_BW_AND:
22122212
case ZEND_BW_XOR:
22132213
if ((t1_type & MAY_BE_STRING) && (t2_type & MAY_BE_STRING)) {
2214-
tmp |= MAY_BE_STRING | MAY_BE_RC1;
2214+
tmp |= MAY_BE_STRING | MAY_BE_RC1 | MAY_BE_RCN;
22152215
}
22162216
if ((t1_type & ~MAY_BE_STRING) || (t2_type & ~MAY_BE_STRING)) {
22172217
tmp |= MAY_BE_LONG;

ext/opcache/tests/jit/and_001.phpt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
--TEST--
2+
JIT BW_AND: 001 (emty string)
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.file_update_protection=0
7+
opcache.jit_buffer_size=1M
8+
--FILE--
9+
<?php
10+
$a = [];
11+
$b = "";
12+
$a["" & $b] *= 3;
13+
?>
14+
DONE
15+
--EXPECTF--
16+
Warning: Undefined array key "" in %sand_001.php on line 4
17+
DONE

0 commit comments

Comments
 (0)