changeset 23:ce5509f09992

Fix certain GET parameter parsing cases to decode URL encoding properly.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 03 Jun 2016 19:18:02 +0300
parents f8a77f25dad6
children aaadd6c104c3
files index.php
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/index.php	Fri Jan 15 18:10:23 2016 +0200
+++ b/index.php	Fri Jun 03 19:18:02 2016 +0300
@@ -49,9 +49,10 @@
     }
     return $res;
   }
+  $values = trim(urldecode($values));
 
   // Assume string, parse it
-  if (($list = preg_split("/\s*,\s*/", trim($values), -1, PREG_SPLIT_NO_EMPTY)) === FALSE)
+  if (($list = preg_split("/\s*,\s*/", $values, -1, PREG_SPLIT_NO_EMPTY)) === FALSE)
     return $res;
 
   if ($pair)
@@ -59,7 +60,7 @@
     // Parse key-value pairs separated by :
     foreach ($list as $str)
     {
-      if (($tmp = preg_split("/\s*:\s*/", trim($str), -1, PREG_SPLIT_NO_EMPTY)) !== FALSE)
+      if (($tmp = preg_split("/\s*:\s*/", $str, -1, PREG_SPLIT_NO_EMPTY)) !== FALSE)
         $res[$tmp[0]] = $tmp[1];
     }
   }