json_decode() will raise a warning on invalid input (PHP 5.6)
authorAlexander Ebert <ebert@woltlab.com>
Sat, 19 Jul 2014 21:56:45 +0000 (23:56 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Sat, 19 Jul 2014 21:56:45 +0000 (23:56 +0200)
wcfsetup/install/files/lib/util/JSON.class.php

index 444d8ca0e8b55d4f3baff5a1faaead4ea69495f8..c651b4d0516aa2d666d4fe169e5c5bad06fca649 100644 (file)
@@ -32,7 +32,7 @@ final class JSON {
         */
        public static function decode($json, $asArray = true) {
                // decodes JSON
-               $data = json_decode($json, $asArray);
+               $data = @json_decode($json, $asArray);
                
                if ($data === null && self::getLastError() !== JSON_ERROR_NONE) {
                        throw new SystemException('Could not decode JSON (error '.self::getLastError().'): '.$json);