]> git.openstreetmap.org Git - nominatim.git/commitdiff
correctly quote regular expression
authorSarah Hoffmann <lonvia@denofr.de>
Sun, 29 Mar 2015 15:23:06 +0000 (17:23 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Sun, 29 Mar 2015 15:23:06 +0000 (17:23 +0200)
lib/Geocode.php

index 9ee812d4ecd57b0e1b12e2f8f65bd80f6b5bcb98..dfb3af2ae823c60eabe816bcc3af2d6c7bb651f1 100644 (file)
                        $aRecheckWords = preg_split('/\b[\s,\\-]*/u',$sQuery);
                        foreach($aRecheckWords as $i => $sWord)
                        {
-                               if (!$sWord) unset($aRecheckWords[$i]);
+                               if (!preg_match('/\pL/', $sWord)) unset($aRecheckWords[$i]);
                        }
 
+            if (CONST_Debug) { echo '<i>Recheck words:<\i>'; var_dump($aRecheckWords); }
+
                        foreach($aSearchResults as $iResNum => $aResult)
                        {
                                if (CONST_Search_AreaPolygons)
                                        if (stripos($sAddress, $sWord)!==false)
                                        {
                                                $iCountWords++;
-                                               if (preg_match("/(^|,)\s*$sWord\s*(,|$)/", $sAddress)) $iCountWords += 0.1;
+                                               if (preg_match("/(^|,)\s*".preg_quote($sWord, '/')."\s*(,|$)/", $sAddress)) $iCountWords += 0.1;
                                        }
                                }