Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Fix infinite recursion in wddx
Summary: It wasn't checking for infinite recursion due to references or self-referential objects. As it turns out closures always return themselves when converted to an array. Raising a warning and returning is how PHP-src deals with this problem, nothing special is done for closures. Reviewed By: alexmalyshev Differential Revision: D3465655 fbshipit-source-id: a42bc34d30cf4825faf33596139c0c05f8e4f5f1
- Loading branch information
Showing
4 changed files
with
54 additions
and
9 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
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,7 @@ | ||
| <?php | ||
| $s1 = wddx_serialize_value(function () {}); | ||
| var_dump($s1); | ||
|
|
||
| $a = []; $a[] =& $a; | ||
| $s2 = wddx_serialize_value($a); | ||
| var_dump($s2); |
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,6 @@ | ||
|
|
||
| Warning: recursion detected in %s/recursion.php on line 2 | ||
| string(%d) "<wddxPacket version='1.0'><header/><data><struct><var name='php_class_name'><string>Closure$;%s$%s$</string></var></struct></data></wddxPacket>" | ||
|
|
||
| Warning: recursion detected in %s/recursion.php on line 6 | ||
| string(87) "<wddxPacket version='1.0'><header/><data><array length='1'></array></data></wddxPacket>" |