1 link.module | _link_parse_str($query) |
Replaces the PHP parse_str() function.
Because parse_str replaces the following characters in query parameters name in order to maintain compatibility with deprecated register_globals directive:
- chr(32) ( ) (space)
- chr(46) (.) (dot)
- chr(91) ([) (open square bracket)
- chr(128) - chr(159) (various)
Parameters
string $query: Query to parse.
Return value
array: Array of query parameters.
See also
http://php.net/manual/en/language.variables.external.php#81080
File
- core/
modules/ link/ link.module, line 671 - Defines simple link field types.
Code
function _link_parse_str($query) {
$query_array = array();
$pairs = explode('&', $query);
foreach ($pairs as $pair) {
$name_value = explode('=', $pair, 2);
$name = urldecode($name_value[0]);
$value = isset($name_value[1]) ? urldecode($name_value[1]) : NULL;
$query_array[$name] = $value;
}
return $query_array;
}