Changeset View
Changeset View
Standalone View
Standalone View
src/utils/utils.php
Show First 20 Lines • Show All 1,617 Lines • ▼ Show 20 Lines | function phutil_http_parameter_pair($key, $value) { | ||||
try { | try { | ||||
assert_stringlike($key); | assert_stringlike($key); | ||||
} catch (InvalidArgumentException $ex) { | } catch (InvalidArgumentException $ex) { | ||||
throw new PhutilProxyException( | throw new PhutilProxyException( | ||||
pht('HTTP query parameter key must be a scalar.'), | pht('HTTP query parameter key must be a scalar.'), | ||||
$ex); | $ex); | ||||
} | } | ||||
$key = (string)$key; | $key = phutil_string_cast($key); | ||||
try { | try { | ||||
assert_stringlike($value); | assert_stringlike($value); | ||||
} catch (InvalidArgumentException $ex) { | } catch (InvalidArgumentException $ex) { | ||||
throw new PhutilProxyException( | throw new PhutilProxyException( | ||||
pht( | pht( | ||||
'HTTP query parameter value (for key "%s") must be a scalar.', | 'HTTP query parameter value (for key "%s") must be a scalar.', | ||||
$key), | $key), | ||||
$ex); | $ex); | ||||
} | } | ||||
$value = (string)$value; | $value = phutil_string_cast($value); | ||||
return array($key, $value); | return array($key, $value); | ||||
} | } | ||||
function phutil_decode_mime_header($header) { | function phutil_decode_mime_header($header) { | ||||
if (function_exists('iconv_mime_decode')) { | if (function_exists('iconv_mime_decode')) { | ||||
return iconv_mime_decode($header, 0, 'UTF-8'); | return iconv_mime_decode($header, 0, 'UTF-8'); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 59 Lines • Show Last 20 Lines |