Browse Source

[Normalizer] fixed a bug

Johannes Schmitt 14 năm trước cách đây
mục cha
commit
d81bebb027
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      Serializer/Normalizer/NativePhpTypeNormalizer.php

+ 1 - 1
Serializer/Normalizer/NativePhpTypeNormalizer.php

@@ -62,7 +62,7 @@ class NativePhpTypeNormalizer extends SerializerAwareNormalizer
         } else if ('string' === $type) {
             return (string) $data;
         } else if ('DateTime' === $type) {
-            if (!is_array($data) && isset($data['time'], $data['timezone'])) {
+            if (!is_array($data) || !isset($data['time'], $data['timezone'])) {
                 throw new \RuntimeException('Invalid input data for type "DateTime".');
             }