Mercurial > hg > batmud > materials
comparison index.php @ 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 | 3c7d311249e3 |
comparison
equal
deleted
inserted
replaced
22:f8a77f25dad6 | 23:ce5509f09992 |
---|---|
47 foreach ($values as $key) | 47 foreach ($values as $key) |
48 $res[trim($key)] = 1; | 48 $res[trim($key)] = 1; |
49 } | 49 } |
50 return $res; | 50 return $res; |
51 } | 51 } |
52 $values = trim(urldecode($values)); | |
52 | 53 |
53 // Assume string, parse it | 54 // Assume string, parse it |
54 if (($list = preg_split("/\s*,\s*/", trim($values), -1, PREG_SPLIT_NO_EMPTY)) === FALSE) | 55 if (($list = preg_split("/\s*,\s*/", $values, -1, PREG_SPLIT_NO_EMPTY)) === FALSE) |
55 return $res; | 56 return $res; |
56 | 57 |
57 if ($pair) | 58 if ($pair) |
58 { | 59 { |
59 // Parse key-value pairs separated by : | 60 // Parse key-value pairs separated by : |
60 foreach ($list as $str) | 61 foreach ($list as $str) |
61 { | 62 { |
62 if (($tmp = preg_split("/\s*:\s*/", trim($str), -1, PREG_SPLIT_NO_EMPTY)) !== FALSE) | 63 if (($tmp = preg_split("/\s*:\s*/", $str, -1, PREG_SPLIT_NO_EMPTY)) !== FALSE) |
63 $res[$tmp[0]] = $tmp[1]; | 64 $res[$tmp[0]] = $tmp[1]; |
64 } | 65 } |
65 } | 66 } |
66 else | 67 else |
67 { | 68 { |