@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Validate PhabricatorSearchTextField value not to be an array

Summary:
PhabricatorSearchTextField.php's parent class PhabricatorSearchField.php defines an (empty) `protected function validateControlValue($value)`.
Override this function in PhabricatorSearchTextField.php by disallowing arrays (as the only data type which cannot be casted into a text value).

Closes T15714

Test Plan: Apply D25518; then manually edit the code in `ManiphestTaskSearchEngine.php` by defining an array and passing that array to the Page Size text field via `id(new PhabricatorSearchTextField())->setDefaultValue($empty_array)`, then go to `/maniphest/query/advanced/` and see the error message.

Reviewers: O1 Blessed Committers, 20after4

Reviewed By: O1 Blessed Committers, 20after4

Subscribers: 20after4, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15714

Differential Revision: https://we.phorge.it/D25519

+9
+9
src/applications/search/field/PhabricatorSearchTextField.php
··· 11 11 return $request->getStr($key); 12 12 } 13 13 14 + protected function validateControlValue($value) { 15 + if (!is_array($value)) { 16 + return; 17 + } 18 + $this->addError( 19 + pht('Invalid'), 20 + pht('Text value for "%s" can not be parsed.', $this->getLabel())); 21 + } 22 + 14 23 protected function newControl() { 15 24 return new AphrontFormTextControl(); 16 25 }