[evolvis-commits] r17201: • fix a regression after running severa =?UTF-8?Q?l=20JSON=20testsuites=20aga?==?UTF-8?Q?inst=20this=E2=86=B5=20?=( amazingly enough, I found exactly one bug in my implementat =?UTF-8?Q?ion=20and=E2=86=B5=20several=20do?==?UTF-8?Q?zen?=(!) bugs in the testsuit =?UTF-8?Q?es=20floating=20around=20on?==?UTF-8?Q?=20the=20=E2=80=99net?=) =?UTF-8?Q?=E2=86=B5=20=E2=80=A2=20lower=20recursi?==?UTF-8?Q?on=20limit?=, to avoid hogging resources

mirabilos at evolvis.org mirabilos at evolvis.org
Wed Apr 27 14:21:29 CEST 2011


Author: mirabilos
Date: 2011-04-27 14:21:29 +0200 (Wed, 27 Apr 2011)
New Revision: 17201

Modified:
   trunk/gforge_base/evolvisforge/gforge/common/include/minijson.php
Log:
• fix a regression after running several JSON testsuites against this
  (amazingly enough, I found exactly one bug in my implementation and
  several dozen(!) bugs in the testsuites floating around on the ’net)
• lower recursion limit, to avoid hogging resources


Modified: trunk/gforge_base/evolvisforge/gforge/common/include/minijson.php
===================================================================
--- trunk/gforge_base/evolvisforge/gforge/common/include/minijson.php	2011-04-19 13:19:46 UTC (rev 17200)
+++ trunk/gforge_base/evolvisforge/gforge/common/include/minijson.php	2011-04-27 12:21:29 UTC (rev 17201)
@@ -95,7 +95,9 @@
 			if ($isunicode) {
 				$y |= ord($v[1]) << 8;
 			}
-			if ($y == 8) {
+			if ($y == 0) {
+				break;
+			} else if ($y == 8) {
 				$rs .= "\\b";
 			} else if ($y == 9) {
 				$rs .= "\\t";
@@ -222,10 +224,10 @@
  *
  * in:	string json
  * in:	reference output-variable (or error string)
- * in:	integer	(optional) recursion depth (default: 512)
+ * in:	integer	(optional) recursion depth (default: 32)
  * out:	boolean	false if an error occured, true = output is valid
  */
-function minijson_decode($sj, &$ov, $depth=512) {
+function minijson_decode($sj, &$ov, $depth=32) {
 	if (!isset($sj) || !$sj) {
 		$ov = "empty input";
 		return false;



More information about the evolvis-commits mailing list