Commit 13453f81 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Bug #5652 / TypeAheadSql: destroyed SQL statement. Fixed broken comparison and...

Bug #5652 / TypeAheadSql: destroyed SQL statement. Fixed broken comparison and missing init of $sqlTest.
parent 2b414f75
...@@ -1265,14 +1265,16 @@ abstract class AbstractBuildForm { ...@@ -1265,14 +1265,16 @@ abstract class AbstractBuildForm {
$sql = trim($sql); $sql = trim($sql);
if ($sql[0] = '[') { if ($sql[0] == '[') {
// Remove optional existing dbIndex token. // Remove optional existing dbIndex token.
$pos = strpos($sql, ']'); $pos = strpos($sql, ']');
$sqlTest = substr($sql, $pos + 1); $sqlTest = substr($sql, $pos + 1);
} else {
$sqlTest = $sql;
} }
if (false === stristr(substr($sqlTest, 0, 7), 'SELECT ')) { if (false === stristr(substr($sqlTest, 0, 7), 'SELECT ')) {
throw new UserFormException("Expect a SELECT statement in " . FE_TYPEAHEAD_SQL . " - got: " . $sql, ERROR_BROKEN_PARAMETER); throw new UserFormException("Expect a SELECT statement in " . FE_TYPEAHEAD_SQL . " - got: " . $sqlTest, ERROR_BROKEN_PARAMETER);
} }
if (false === stristr($sql, ' LIMIT ')) { if (false === stristr($sql, ' LIMIT ')) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment