From 7629d4417587fabe3f6f4b4f5e6caf0475ba3c89 Mon Sep 17 00:00:00 2001 From: Jonathan Lomas Date: Fri, 15 Jun 2012 17:19:56 -0700 Subject: [PATCH] Strip non-integers out of task id entries Test Plan: search in task ids for `t123, 456, pickles` (assuming 123 and 456 exist), and you will see 123 and 456 listed. This is done in the buildQueryFromRequest function, so it would process a hand-written GET string just fine too. Reviewers: epriestley CC: aran, Korvin Maniphest Tasks: T1365 Differential Revision: https://secure.phabricator.com/D2771 --- .../controller/ManiphestTaskListController.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/applications/maniphest/controller/ManiphestTaskListController.php b/src/applications/maniphest/controller/ManiphestTaskListController.php index 3eda25d564..776eb89e80 100644 --- a/src/applications/maniphest/controller/ManiphestTaskListController.php +++ b/src/applications/maniphest/controller/ManiphestTaskListController.php @@ -661,6 +661,24 @@ final class ManiphestTaskListController extends ManiphestController { $exclude_project_phids = $request->getStrList('xprojects'); $task_ids = $request->getStrList('tasks'); + + // We only need the integer portion of each task ID, so get rid of any non- + // numeric elements + $numeric_task_ids = array(); + + foreach ($task_ids as $task_id) { + $task_id = preg_replace('/[a-zA-Z]+/', '', $task_id); + if (!empty($task_id)) { + $numeric_task_ids[] = $task_id; + } + } + + if (empty($numeric_task_ids)) { + $numeric_task_ids = array(null); + } + + $task_ids = $numeric_task_ids; + $owner_phids = $request->getStrList('owners'); $author_phids = $request->getStrList('authors');