From 5f27cb0eab98fa6b4856278436d6aacadc4a1acb Mon Sep 17 00:00:00 2001
From: Michael Hamann <michael@content-space.de>
Date: Tue, 14 Jun 2011 20:29:56 +0200
Subject: [PATCH] Fix lowercasing of words in the indexer FS#2270

On certain PHP installations (it has been reproduced with PHP version
5.2.0-8+etch11) the indexer failed to lowercase words in the indexer
so the fulltext search was partially broken.
---
 inc/indexer.php | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/inc/indexer.php b/inc/indexer.php
index 1f0094876..546b2a288 100644
--- a/inc/indexer.php
+++ b/inc/indexer.php
@@ -444,9 +444,12 @@ class Doku_Indexer {
             $text = utf8_stripspecials($text, ' ', '\._\-:'.$wc);
 
         $wordlist = explode(' ', $text);
-        foreach ($wordlist as $i => &$word) {
-            $word = (preg_match('/[^0-9A-Za-z]/u', $word)) ?
+        foreach ($wordlist as $i => $word) {
+            $wordlist[$i] = (preg_match('/[^0-9A-Za-z]/u', $word)) ?
                 utf8_strtolower($word) : strtolower($word);
+        }
+
+        foreach ($wordlist as $i => $word) {
             if ((!is_numeric($word) && strlen($word) < IDX_MINWORDLENGTH)
               || array_search($word, $stopwords) !== false)
                 unset($wordlist[$i]);
-- 
GitLab