if json_encode fails - failback to php version
authorAlan Knowles <alan@roojs.com>
Tue, 19 May 2020 07:35:04 +0000 (15:35 +0800)
committerAlan Knowles <alan@roojs.com>
Tue, 19 May 2020 07:35:04 +0000 (15:35 +0800)
Pman.php

index d387018..4a8acec 100644 (file)
--- a/Pman.php
+++ b/Pman.php
@@ -357,7 +357,10 @@ class Pman extends HTML_FlexyFramework_Page
             header("Content-type: text/javascript");
         }
         if (function_exists("json_encode")) {
-            return json_encode($v);
+            $ret=  json_encode($v);
+            if ($ret !== false) {
+                return $ret;
+            }
         }
         require_once 'Services/JSON.php';
         $js = new Services_JSON();
@@ -661,6 +664,7 @@ class Pman extends HTML_FlexyFramework_Page
             }
             file_put_contents($fn, $ret);
         }
+        
         echo $ret;
         exit;
     }