/** * Parses a query string (x=y&a=b&c[]=d) into a structured array format. * * @param string $string * * @return array */ public static function parseQueryString($string) { parse_str($string, $output); if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) { XenForo_Application::undoMagicQuotes($output); } return $output; }
/** * Parses a query string (x=y&a=b&c[]=d) into a structured array format. * * Note that this can handle very long query strings, but it has problems * if there are conflicting elements that split the "chunks" that are made * internally. Workaround this using distinct keys for each input whenever possible. * * @param string $string * * @return array */ public static function parseQueryString($string) { $max = intval(@ini_get('max_input_vars')); if ($max && substr_count($string, '&') >= $max) { $string = preg_replace_callback('/(?<=^|&)([^=&]+)(\\[\\]|%5B%5D)/U', array('XenForo_Application', 'parseQueryStringCallback'), $string); self::$_qsPartCounter = array(); $chunks = array_chunk(explode('&', $string), $max, true); $output = array(); foreach ($chunks as $chunk) { parse_str(implode('&', $chunk), $values); $output = self::mapMerge($output, $values); } } else { parse_str($string, $output); } if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) { XenForo_Application::undoMagicQuotes($output); } return $output; }