-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #167: uopz_set_return() overload confusion
If the first ZPP fails, clazz might be assigned, but is not nulled afterwards. To avoid potential BC breaks by swapping the ZPPs, we hack in the nulling of the `clazz`, making use of the short-circuit behavior of `&&`.
- Loading branch information
Showing
2 changed files
with
18 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--TEST-- | ||
uopz_set_return() overload confusion | ||
--EXTENSIONS-- | ||
uopz | ||
--INI-- | ||
uopz.disable=0 | ||
--FILE-- | ||
<?php | ||
class Foo {} | ||
function foo(): int { | ||
return 42; | ||
} | ||
uopz_set_return("foo", function() {return 4711;}, true); | ||
var_dump(foo()); | ||
?> | ||
--EXPECT-- | ||
int(4711) |
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