From 5e400ab5ed8e9a43861d80534c0aa5b2636a7e37 Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Fri, 17 Aug 2012 07:57:07 -0400
Subject: [PATCH] Switched to functional approach for ID escaping.

---
 module/VuFind/src/VuFind/Search/Solr/Params.php | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/module/VuFind/src/VuFind/Search/Solr/Params.php b/module/VuFind/src/VuFind/Search/Solr/Params.php
index b65d6a9d662..fea7aaac953 100644
--- a/module/VuFind/src/VuFind/Search/Solr/Params.php
+++ b/module/VuFind/src/VuFind/Search/Solr/Params.php
@@ -385,9 +385,8 @@ class Params extends BaseParams
     {
         // No need for spell checking on an ID query!
         $this->options->spellcheckEnabled(false);
-        for ($i = 0; $i < count($ids); $i++) {
-            $ids[$i] = '"' . addcslashes($ids[$i], '"') . '"';
-        }
+        $callback = function($i) { return '"' . addcslashes($i, '"') . '"'; };
+        $ids = array_map($callback, $ids);
         $this->setOverrideQuery('id:(' . implode(' OR ', $ids) . ')');
     }
 
-- 
GitLab