fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [9109] JSON Serializer produces invalid JSON if a val


From: Sigurd Nes
Subject: [Fmsystem-commits] [9109] JSON Serializer produces invalid JSON if a value ends with quote
Date: Tue, 10 Apr 2012 07:03:02 +0000

Revision: 9109
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9109
Author:   sigurdne
Date:     2012-04-10 07:02:55 +0000 (Tue, 10 Apr 2012)
Log Message:
-----------
JSON Serializer produces invalid JSON if a value ends with quote

Modified Paths:
--------------
    trunk/index.php

Modified: trunk/index.php
===================================================================
--- trunk/index.php     2012-04-09 17:26:33 UTC (rev 9108)
+++ trunk/index.php     2012-04-10 07:02:55 UTC (rev 9109)
@@ -109,13 +109,23 @@
                        // comply with RFC 4627
                        header('Content-Type: application/json'); 
                        $return_data = $GLOBALS[$class]->$method();
-                       echo json_encode($return_data);
+                       /*
+                       * JSON Serializer produces invalid JSON if a value ends 
with quote
+                       */
+                       $v = json_encode($return_data);
+                       if(preg_match('/^"(.*)"$/', $v, $matches))
+                       {
+                       $v = $matches[1];
+               }
+                       echo $v;
+//                     echo json_encode($return_data);
                        $GLOBALS['phpgw_info']['flags']['nofooter'] = true;
 
                        //If debug info is not triggered elsewhere.
                        if 
(isset($GLOBALS['phpgw_info']['user']['apps']['admin']) && DEBUG_TIMER && 
!phpgwapi_cache::session_get($app,'id_debug'))
                        {
                                $debug_timer_stop = perfgetmicrotime();
+                               //BTW: wil not destroy the json output - click 
on the 'Debug-link' to view message
                                _debug_array(lang('page prepared in %1 
seconds.', $debug_timer_stop - $GLOBALS['debug_timer_start'] ));
                        }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]