Skip to content

Commit 35786e3

Browse files
committed
Merge branch 'PHP-8.1'
* PHP-8.1: Fixed incorrect refcountion inference for BW_NOT
2 parents 40b258f + ecc4d13 commit 35786e3

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
@@ -2468,7 +2468,7 @@ static zend_always_inline zend_result _zend_update_type_info(
24682468
case ZEND_BW_NOT:
24692469
tmp = 0;
24702470
if (t1 & MAY_BE_STRING) {
2471-
tmp |= MAY_BE_STRING | MAY_BE_RC1;
2471+
tmp |= MAY_BE_STRING | MAY_BE_RC1 | MAY_BE_RCN;
24722472
}
24732473
if (t1 & (MAY_BE_ANY-MAY_BE_STRING)) {
24742474
tmp |= MAY_BE_LONG;
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)