Differential D25170 Diff 611 src/applications/typeahead/controller/PhabricatorTypeaheadModularDatasourceController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/typeahead/controller/PhabricatorTypeaheadModularDatasourceController.php
Show All 33 Lines | $sources = id(new PhutilClassMapQuery()) | ||||
->execute(); | ->execute(); | ||||
if (isset($sources[$class])) { | if (isset($sources[$class])) { | ||||
$source = $sources[$class]; | $source = $sources[$class]; | ||||
$parameters = array(); | $parameters = array(); | ||||
$raw_parameters = $request->getStr('parameters'); | $raw_parameters = $request->getStr('parameters'); | ||||
if (strlen($raw_parameters)) { | if (phutil_nonempty_string($raw_parameters)) { | ||||
valerio.bozzolan: ✅ I was honestly not able to completely test the non-null values of `$raw_parameters` so I have… | |||||
try { | try { | ||||
$parameters = phutil_json_decode($raw_parameters); | $parameters = phutil_json_decode($raw_parameters); | ||||
} catch (PhutilJSONParserException $ex) { | } catch (PhutilJSONParserException $ex) { | ||||
return $this->newDialog() | return $this->newDialog() | ||||
->setTitle(pht('Invalid Parameters')) | ->setTitle(pht('Invalid Parameters')) | ||||
->appendParagraph( | ->appendParagraph( | ||||
pht( | pht( | ||||
'The HTTP parameter named "parameters" for this request is '. | 'The HTTP parameter named "parameters" for this request is '. | ||||
▲ Show 20 Lines • Show All 415 Lines • Show Last 20 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0
✅ I was honestly not able to completely test the non-null values of $raw_parameters so I have not any idea about the intended semantic usage, but the getStr() method is supposed to return strings, so this seems very OK to me.
The method phutil_nonempty_string() will report any alien type, and this OK there.