From c6054def26902467e824a62e14ba7f6b0a5c493e Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 27 Apr 2020 13:24:59 -0700 Subject: [PATCH] (stable) 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 --- .../conduit/parametertype/ConduitParameterType.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/applications/conduit/parametertype/ConduitParameterType.php b/src/applications/conduit/parametertype/ConduitParameterType.php index 4eca31d96c..9adf435cf2 100644 --- a/src/applications/conduit/parametertype/ConduitParameterType.php +++ b/src/applications/conduit/parametertype/ConduitParameterType.php @@ -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,