Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed bug #81096: Inconsistent range inferece for variables passed by…
… reference Detect references before range inference and exclude them from range inference.
- Loading branch information
Showing
3 changed files
with
218 additions
and
11 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,25 @@ | ||
--TEST-- | ||
Range info for references (1) | ||
--FILE-- | ||
<?php | ||
|
||
function test() { | ||
escape_x($x); | ||
$x = 0; | ||
modify_x(); | ||
return (int) $x; | ||
} | ||
|
||
function escape_x(&$x) { | ||
$GLOBALS['x'] =& $x; | ||
} | ||
|
||
function modify_x() { | ||
$GLOBALS['x']++; | ||
} | ||
|
||
var_dump(test()); | ||
|
||
?> | ||
--EXPECT-- | ||
int(1) |
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,25 @@ | ||
--TEST-- | ||
Range info for references (2) | ||
--FILE-- | ||
<?php | ||
|
||
function test() { | ||
escape_x($x); | ||
$x = 0; | ||
modify_x(); | ||
return PHP_INT_MAX + (int) $x; | ||
} | ||
|
||
function escape_x(&$x) { | ||
$GLOBALS['x'] =& $x; | ||
} | ||
|
||
function modify_x() { | ||
$GLOBALS['x']++; | ||
} | ||
|
||
var_dump(test()); | ||
|
||
?> | ||
--EXPECTF-- | ||
float(%s) |