-
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.
Objects reuse the GC_PERSISTENT flag as IS_OBJ_WEAKLY_REFERENCED, which we did not account for in ZVAL_COPY_OR_DUP. To make things worse the incorrect zval_copy_ctor_func() invocation silently did nothing. To avoid that, add an assertion that it should only be called with arrays and strings (unlike the normal zval_copy_ctor() which can be safely called on any zval).
- Loading branch information
Showing
4 changed files
with
25 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
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,18 @@ | ||
--TEST-- | ||
Use enum as WeakMap key | ||
--FILE-- | ||
<?php | ||
|
||
enum TestEnum { | ||
case A; | ||
} | ||
|
||
$map = new WeakMap(); | ||
$map[TestEnum::A] = 'a string'; | ||
var_dump($map[TestEnum::A]); | ||
var_dump($map[TestEnum::A]); | ||
|
||
?> | ||
--EXPECT-- | ||
string(8) "a string" | ||
string(8) "a string" |
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