-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* PHP-8.0: Fix incorrect optimization of ASSIGN_OP that may lead to memory leak
- Loading branch information
Showing
2 changed files
with
40 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--TEST-- | ||
ASSIGN_OP 001: Incrrect optimization of ASSIGN_OP may lead to memory leak | ||
--INI-- | ||
opcache.enable=1 | ||
opcache.enable_cli=1 | ||
opcache.optimization_level=-1 | ||
--FILE-- | ||
<?php | ||
function test() { | ||
for ($i = 0; $i < 10; $i++) { | ||
$a = $a += $a < true; | ||
$a += $a; | ||
$a = []; | ||
$a['b'] += 1; | ||
} | ||
} | ||
test(); | ||
?> | ||
--EXPECTF-- | ||
Warning: Undefined variable $a in %sassign_op_001.php on line 4 | ||
|
||
Warning: Undefined variable $a in %sassign_op_001.php on line 4 | ||
|
||
Warning: Undefined array key "b" in %sassign_op_001.php on line 7 | ||
|
||
Fatal error: Uncaught TypeError: Unsupported operand types: array + bool in %sassign_op_001.php:4 | ||
Stack trace: | ||
#0 %sassign_op_001.php(10): test() | ||
#1 {main} | ||
thrown in %sassign_op_001.php on line 4 |