mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[ticket/12852] Make get_url_parts handle get variable with no value
PHPBB3-12852
This commit is contained in:
parent
10c99b3c2b
commit
17e4e5f8c4
1 changed files with 21 additions and 3 deletions
|
@ -316,7 +316,7 @@ class path_helper
|
|||
* Glue URL parameters together
|
||||
*
|
||||
* @param array $params URL parameters in the form of array(name => value)
|
||||
* @return string Returns the glued string, e.g. name1=value1&name2=value2
|
||||
* @return string Returns the glued string, e.g. name1=value1&name2&name3=value3
|
||||
*/
|
||||
public function glue_url_params($params)
|
||||
{
|
||||
|
@ -324,7 +324,15 @@ class path_helper
|
|||
|
||||
foreach ($params as $key => $value)
|
||||
{
|
||||
$_params[] = $key . '=' . $value;
|
||||
// some parameters do not have value
|
||||
if($value !== null)
|
||||
{
|
||||
$_params[] = $key . '=' . $value;
|
||||
}
|
||||
else
|
||||
{
|
||||
$_params[] = $key;
|
||||
}
|
||||
}
|
||||
return implode('&', $_params);
|
||||
}
|
||||
|
@ -353,7 +361,17 @@ class path_helper
|
|||
{
|
||||
continue;
|
||||
}
|
||||
list($key, $value) = explode('=', $argument, 2);
|
||||
|
||||
// some parameters don't have value
|
||||
if (strpos($argument, '=') !== false)
|
||||
{
|
||||
list($key, $value) = explode('=', $argument, 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
$key = $argument;
|
||||
$value = null;
|
||||
}
|
||||
|
||||
if ($key === '')
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue