Skip to content

Commit ecc4d13

Browse files
committed
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0: Fixed incorrect refcountion inference for BW_NOT
2 parents 97f0c0b + 3c53a9f commit ecc4d13

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

Zend/Optimizer/zend_inference.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2446,7 +2446,7 @@ static zend_always_inline int _zend_update_type_info(
24462446
case ZEND_BW_NOT:
24472447
tmp = 0;
24482448
if (t1 & MAY_BE_STRING) {
2449-
tmp |= MAY_BE_STRING | MAY_BE_RC1;
2449+
tmp |= MAY_BE_STRING | MAY_BE_RC1 | MAY_BE_RCN;
24502450
}
24512451
if (t1 & (MAY_BE_ANY-MAY_BE_STRING)) {
24522452
tmp |= MAY_BE_LONG;

ext/opcache/tests/jit/bw_not_001.phpt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--TEST--
2+
JIT BW_NOT: 001 Incorrect refcounting inference
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+
$x[~"$x"]*=1;
12+
?>
13+
DONE
14+
--EXPECTF--
15+
Warning: Undefined variable $x in %sbw_not_001.php on line 2
16+
17+
Warning: Undefined variable $x in %sbw_not_001.php on line 2
18+
19+
Warning: Undefined array key "" in %sbw_not_001.php on line 2
20+
DONE

0 commit comments

Comments
 (0)