Fix urlencoding in escapeJson()
authorMichael M Slusarz <slusarz@curecanti.org>
Fri, 31 Jul 2009 17:35:10 +0000 (11:35 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Fri, 31 Jul 2009 21:01:55 +0000 (15:01 -0600)
framework/Core/lib/Horde.php

index d23a260..d20745d 100644 (file)
@@ -628,11 +628,10 @@ HTML;
      */
     static public function escapeJson($data, $options = array())
     {
-        $json = Horde_Serialize::serialize($data, Horde_Serialize::JSON, empty($options['charset']) ? Horde_Nls::getCharset() : $options['charset']);
-        if (!empty($options['urlencode'])) {
-            $json = rawurlencode($json);
-        }
-        return '/*-secure-' . $json . '*/';
+        $json = '/*-secure-' . Horde_Serialize::serialize($data, Horde_Serialize::JSON, empty($options['charset']) ? Horde_Nls::getCharset() : $options['charset']) . '*/';
+        return empty($options['urlencode'])
+            ? $json
+            : '\'' . rawurlencode($json) . '\'';
     }
 
     /**