Browse Source

Json::encode did not handle JsonSerializable objects

tags/2.0.0-beta
Carsten Brandt 11 years ago
parent
commit
060775b0da
  1. 1
      framework/CHANGELOG.md
  2. 4
      framework/yii/helpers/BaseJson.php

1
framework/CHANGELOG.md

@ -11,6 +11,7 @@ Yii Framework 2 Change Log
- Bug #1545: It was not possible to execute db Query twice, params where missing (cebe)
- Bug: Fixed `Call to a member function registerAssetFiles() on a non-object` in case of wrong `sourcePath` for an asset bundle (samdark)
- Bug: Fixed incorrect event name for `yii\jui\Spinner` (samdark)
- Bug: Json::encode() did not handle objects that implement JsonSerializable interface correctly (cebe)
- Enh #1293: Replaced Console::showProgress() with a better approach. See Console::startProgress() for details (cebe)
- Enh #1406: DB Schema support for Oracle Database (p0larbeer, qiangxue)
- Enh #1437: Added ListView::viewParams (qiangxue)

4
framework/yii/helpers/BaseJson.php

@ -81,6 +81,10 @@ class BaseJson
*/
protected static function processData($data, &$expressions, $expPrefix)
{
if ($data instanceof \JsonSerializable) {
return $data;
}
if (is_object($data)) {
if ($data instanceof JsExpression) {
$token = "!{[$expPrefix=" . count($expressions) . ']}!';

Loading…
Cancel
Save