1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 06:42:42 +01:00

Make Conduit "www-form-urlencoded" parsing of "true" and "false" case-insensitive

Summary:
See PHI1710. Python encodes `True` as `True` (with an uppercase "T") when building URLs.

We currently do not accept this as a "truthy" value, but it's reasonable and unambiguous. Accept "True", "TRUE", "tRuE", etc.

Test Plan: Made a cURL conduit call with "True" and "tRuE". Before patch: failure to decoded booleans; after patch: successful interpretation of "true" variations.

Differential Revision: https://secure.phabricator.com/D21177
This commit is contained in:
epriestley 2020-04-27 13:24:59 -07:00
parent b5bed7b0fa
commit 6617005365

View file

@ -129,8 +129,9 @@ abstract class ConduitParameterType extends Phobject {
'true' => true,
);
if (!$strict && is_string($value) && isset($bool_strings[$value])) {
$value = $bool_strings[$value];
$normal_value = phutil_utf8_strtolower($value);
if (!$strict && is_string($value) && isset($bool_strings[$normal_value])) {
$value = $bool_strings[$normal_value];
} else if (!is_bool($value)) {
$this->raiseValidationException(
$request,