Commit e11ecad1 by Paul Klimov

Object handling at `BaseVarDumper::export()` reworked

parent 3469b471
...@@ -182,17 +182,7 @@ class BaseVarDumper ...@@ -182,17 +182,7 @@ class BaseVarDumper
} }
break; break;
case 'object': case 'object':
if ($var instanceof Arrayable) { self::$_output .= 'unserialize(' . var_export(serialize($var), true) . ')';
self::exportInternal($var->toArray(), $level);
} elseif ($var instanceof \IteratorAggregate) {
$varAsArray = [];
foreach ($var as $key => $value) {
$varAsArray[$key] = $value;
}
self::exportInternal($varAsArray, $level);
} else {
self::$_output .= serialize($var);
}
break; break;
default: default:
self::$_output .= var_export($var, true); self::$_output .= var_export($var, true);
......
...@@ -88,7 +88,7 @@ RESULT; ...@@ -88,7 +88,7 @@ RESULT;
$var = new \StdClass(); $var = new \StdClass();
$var->testField = 'Test Value'; $var->testField = 'Test Value';
$expectedResult = serialize($var); $expectedResult = "unserialize('" . serialize($var) . "')";
$data[] = [$var, $expectedResult]; $data[] = [$var, $expectedResult];
return $data; return $data;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment