-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix inference for assignment of known object to reference
We cannot retain the ce information in that case, we have to assume the ce may change indirectly through the reference. Fixes oss-fuzz #46720.
- Loading branch information
Showing
2 changed files
with
26 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--TEST-- | ||
Assigning an object of known type to a reference variable | ||
--FILE-- | ||
<?php | ||
|
||
class Test { | ||
public int $x = 42; | ||
} | ||
|
||
function test() { | ||
$r =& $o; | ||
$o = new Test; | ||
$r = new stdClass; | ||
$r->x = 3.141; | ||
var_dump(is_float($o->x)); | ||
} | ||
test(); | ||
|
||
?> | ||
--EXPECT-- | ||
bool(true) |
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