Changeset View
Changeset View
Standalone View
Standalone View
src/utils/utils.php
Show First 20 Lines • Show All 1,308 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 206 Lines • ▼ Show 20 Lines | function phutil_hashes_are_identical($u, $v) { | ||||
$bits = 0; | $bits = 0; | ||||
for ($ii = 0; $ii < $len; $ii++) { | for ($ii = 0; $ii < $len; $ii++) { | ||||
$bits |= (ord($u[$ii]) ^ ord($v[$ii])); | $bits |= (ord($u[$ii]) ^ ord($v[$ii])); | ||||
} | } | ||||
return ($bits === 0); | return ($bits === 0); | ||||
} | } | ||||
/** | |||||
* Build a query string from a dictionary. | |||||
* | |||||
* @param map<string, string> Dictionary of parameters. | |||||
* @return string HTTP query string. | |||||
*/ | |||||
function phutil_build_http_querystring(array $parameters) { | |||||
return http_build_query($parameters, '', '&'); | |||||
} |
This codebase targets PHP 5.2.3, but parse_ini_string() was not introduced until PHP 5.3.0.