From: marc tobias Date: Fri, 6 Apr 2018 11:46:14 +0000 (+0200) Subject: when looking for keywords on detail page a SQL bracket error was possible X-Git-Tag: v3.2.0~98^2 X-Git-Url: https://git.openstreetmap.org/nominatim.git/commitdiff_plain/908c66ca84d8f321911aa93d69a8f311ee8dd347?ds=sidebyside;hp=62719f58c9cc2dd88ea2efd0fbd577f12082c27c when looking for keywords on detail page a SQL bracket error was possible --- diff --git a/website/details.php b/website/details.php index 24e8cd76..e2a8a031 100755 --- a/website/details.php +++ b/website/details.php @@ -210,21 +210,23 @@ $aPlaceSearchNameKeywords = false; $aPlaceSearchAddressKeywords = false; if ($oParams->getBool('keywords')) { $sSQL = "SELECT * FROM search_name WHERE place_id = $iPlaceID"; - $aPlaceSearchName = $oDB->getRow($sSQL); - if (PEAR::isError($aPlaceSearchName)) { // possible timeout + $aPlaceSearchName = $oDB->getRow($sSQL); // can be null + if (!$aPlaceSearchName || PEAR::isError($aPlaceSearchName)) { // possible timeout $aPlaceSearchName = []; } - $sSQL = 'SELECT * FROM word WHERE word_id in ('.substr($aPlaceSearchName['name_vector'], 1, -1).')'; - $aPlaceSearchNameKeywords = $oDB->getAll($sSQL); - if (PEAR::isError($aPlaceSearchNameKeywords)) { // possible timeout - $aPlaceSearchNameKeywords = []; - } + if (!empty($aPlaceSearchName)) { + $sSQL = 'SELECT * FROM word WHERE word_id in ('.substr($aPlaceSearchName['name_vector'], 1, -1).')'; + $aPlaceSearchNameKeywords = $oDB->getAll($sSQL); + if (PEAR::isError($aPlaceSearchNameKeywords)) { // possible timeout + $aPlaceSearchNameKeywords = []; + } - $sSQL = 'SELECT * FROM word WHERE word_id in ('.substr($aPlaceSearchName['nameaddress_vector'], 1, -1).')'; - $aPlaceSearchAddressKeywords = $oDB->getAll($sSQL); - if (PEAR::isError($aPlaceSearchAddressKeywords)) { // possible timeout - $aPlaceSearchAddressKeywords = []; + $sSQL = 'SELECT * FROM word WHERE word_id in ('.substr($aPlaceSearchName['nameaddress_vector'], 1, -1).')'; + $aPlaceSearchAddressKeywords = $oDB->getAll($sSQL); + if (PEAR::isError($aPlaceSearchAddressKeywords)) { // possible timeout + $aPlaceSearchAddressKeywords = []; + } } }