Fixes #2655: Arrayable and ArrayableTrait are incompatible for some PHP versions.

This commit is contained in:
Qiang Xue
2014-03-07 19:08:27 -05:00
parent 6d97ded6c6
commit fad635440b
15 changed files with 131 additions and 175 deletions

View File

@ -91,7 +91,11 @@ class BaseJson
} elseif ($data instanceof Arrayable) {
$data = $data->toArray();
} else {
$data = get_object_vars($data);
$result = [];
foreach ($data as $name => $value) {
$result[$name] = $value;
}
$data = $result;
}
if ($data === []) {