Merge pull request #3 from fredemmott/hhvm

Make SplObjectStorage exporting in HHVM match Zend
This commit is contained in:
Sebastian Bergmann 2014-01-29 22:41:03 -08:00
commit c66626bdac
1 changed files with 8 additions and 1 deletions

View File

@ -270,9 +270,16 @@ class Exporter
}
// Some internal classes like SplObjectStorage don't work with the
// above (fast) mechanism nor with reflection
// above (fast) mechanism nor with reflection in Zend.
// Format the output similarly to print_r() in this case
if ($value instanceof \SplObjectStorage) {
// However, the fast method does work in HHVM, and exposes the
// internal implementation. Hide it again.
if (property_exists('\SplObjectStorage', '__storage')) {
unset($array['__storage']);
} else if (property_exists('\SplObjectStorage', 'storage')) {
unset($array['storage']);
}
foreach ($value as $key => $val) {
$array[spl_object_hash($val)] = array(
'obj' => $val,