json_decode() returns null on error, not false
authorMichael M Slusarz <slusarz@curecanti.org>
Fri, 21 Jan 2011 23:39:48 +0000 (16:39 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Fri, 21 Jan 2011 23:40:55 +0000 (16:40 -0700)
framework/Serialize/lib/Horde/Serialize.php

index 3130b28..39e85ac 100644 (file)
@@ -355,7 +355,10 @@ class Horde_Serialize
             break;
 
         case self::JSON:
-            $data = json_decode($data);
+            $out = json_decode($data);
+            if (!is_null($out) || (strcasecmp($data, 'null') === 0)) {
+                return $out;
+            }
             break;
 
         case self::LZF: