Changeset View
Changeset View
Standalone View
Standalone View
src/utils/utils.php
Show First 20 Lines • Show All 1,561 Lines • ▼ Show 20 Lines | |||||
*/ | */ | ||||
function phutil_build_http_querystring(array $parameters) { | function phutil_build_http_querystring(array $parameters) { | ||||
// We want to encode in RFC3986 mode, but "http_build_query()" did not get | // We want to encode in RFC3986 mode, but "http_build_query()" did not get | ||||
// a flag for that mode until PHP 5.4.0. This is equivalent to calling | // a flag for that mode until PHP 5.4.0. This is equivalent to calling | ||||
// "http_build_query()" with the "PHP_QUERY_RFC3986" flag. | // "http_build_query()" with the "PHP_QUERY_RFC3986" flag. | ||||
$query = array(); | $query = array(); | ||||
foreach ($parameters as $key => $value) { | foreach ($parameters as $key => $value) { | ||||
if (is_array($value) || is_object($value)) { | |||||
throw new Exception( | |||||
pht( | |||||
'HTTP query parameter (with key "%s") is not a scalar. Parameters '. | |||||
'must all be scalars.', | |||||
$key)); | |||||
} | |||||
$query[] = rawurlencode($key).'='.rawurlencode($value); | $query[] = rawurlencode($key).'='.rawurlencode($value); | ||||
} | } | ||||
$query = implode($query, '&'); | $query = implode($query, '&'); | ||||
return $query; | return $query; | ||||
} | } | ||||
function phutil_decode_mime_header($header) { | function phutil_decode_mime_header($header) { | ||||
Show All 13 Lines |