Changeset View
Changeset View
Standalone View
Standalone View
src/utils/utils.php
Show First 20 Lines • Show All 1,323 Lines • ▼ Show 20 Lines | if (!function_exists('parse_ini_string')) { | ||||
throw new PhutilMethodNotImplementedException( | throw new PhutilMethodNotImplementedException( | ||||
pht( | pht( | ||||
'%s is not compatible with your version of PHP (%s). This function '. | '%s is not compatible with your version of PHP (%s). This function '. | ||||
'is only supported on PHP versions newer than 5.3.0.', | 'is only supported on PHP versions newer than 5.3.0.', | ||||
__FUNCTION__, | __FUNCTION__, | ||||
phpversion())); | phpversion())); | ||||
} | } | ||||
$results = @parse_ini_string($string, true, INI_SCANNER_RAW); | $results = @parse_ini_string($string, true, INI_SCANNER_RAW); | ||||
Lint: PHP Compatibility: This codebase targets PHP 5.2.3, but `parse_ini_string()` was not introduced until PHP 5.3.0. | |||||
Lint: PHP Compatibility This codebase targets PHP 5.2.3, but INI_SCANNER_RAW was not introduced until PHP 5.3.0. Lint: PHP Compatibility: This codebase targets PHP 5.2.3, but `INI_SCANNER_RAW` was not introduced until PHP 5.3.0. | |||||
if ($results === false) { | if ($results === false) { | ||||
throw new PhutilINIParserException(trim($trap->getErrorsAsString())); | throw new PhutilINIParserException(trim($trap->getErrorsAsString())); | ||||
} | } | ||||
foreach ($results as $section => $result) { | foreach ($results as $section => $result) { | ||||
if (!is_array($result)) { | if (!is_array($result)) { | ||||
// We JSON decode the value in ordering to perform the following | // We JSON decode the value in ordering to perform the following | ||||
▲ Show 20 Lines • Show All 221 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 |
This codebase targets PHP 5.2.3, but parse_ini_string() was not introduced until PHP 5.3.0.