[Fusionforge-commits] r15751 - trunk/src/common/include

Thorsten Glaser mirabilos at fusionforge.org
Mon Jun 11 15:16:29 CEST 2012


Author: mirabilos
Date: 2012-06-11 15:16:28 +0200 (Mon, 11 Jun 2012)
New Revision: 15751

Modified:
   trunk/src/common/include/minijson.php
Log:
merge a change from Evolvis with the following commit message:

sort Object keys ASCIIbetically

while developing, in my spare time, MirJSON (which will eventually
replace the GPL?\226?\128?\153d minijson and be available in more languages), it
was discovered that the output MUST be stable as to not leak, e.g.
a hashtable?\226?\128?\153s seed value; in PHP, this is not currently an issue ?\226?\128?\147
	?\226?\128?\156We are looking into it. Changing the core
	hash function in PHP isn't a trivial change
	and will take us some time.?\226?\128?\157
				   ?\226?\128?\147 Rasmus Lerdorf
?\226?\128?\147 but we actually compare JSON-serialised values to determine whe?\226?\128?\144
ther they have changed (at least in the json_prefs branch), so?\226?\128?\166 it
is still a valid argument


Modified: trunk/src/common/include/minijson.php
===================================================================
--- trunk/src/common/include/minijson.php	2012-06-11 11:28:33 UTC (rev 15750)
+++ trunk/src/common/include/minijson.php	2012-06-11 13:16:28 UTC (rev 15751)
@@ -2,7 +2,7 @@
 /**
  * Minimal complete JSON generator and parser for FusionForge
  *
- * Copyright © 2010, 2011
+ * Copyright © 2010, 2011, 2012
  *	Thorsten “mirabilos” Glaser <t.glaser at tarent.de>
  * All rights reserved.
  *
@@ -188,6 +188,7 @@
 		$rs = "{";
 		if ($ri !== false)
 			$rs .= "\n";
+		sort($k, SORT_STRING);
 		foreach ($k as $v) {
 			if ($first)
 				$first = false;
@@ -626,5 +627,3 @@
 	$ov = (float)$s;
 	return true;
 }
-
-?>




More information about the Fusionforge-commits mailing list