Bug #87620

ContentObjectRenderer->searchWhere will do exception with too short word.

Added by Alexey Atsyn 15 days ago. Updated 15 days ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Database API (Doctrine DBAL)
Target version:
-
Start date:
2019-02-01
Due date:
% Done:

0%

TYPO3 Version:
8
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

If a $searchWords is one word with length less then three digits result query will be broken.

#line: 7023
        foreach ($searchWords as $searchWord) {
            $searchWord = trim($searchWord);
            if (strlen($searchWord) < 3) {//TODO code will do that
                continue;
            }
            $searchWordConstraint = $queryBuilder->expr()->orX();
            $searchWord = $queryBuilder->escapeLikeWildcards($searchWord);
            foreach ($searchFields as $field) {
                $searchWordConstraint->add(
                    $queryBuilder->expr()->like($prefixTableName . $field, $queryBuilder->quote('%' . $searchWord . '%'))
                );
            }

            if ($searchWordConstraint->count()) {
                $where->add($searchWordConstraint);//TODO And this code will never be called
            }
        }

        return ' AND ' . (string)$where;

In the result we will get ' AND ' in any query it will call fatal error.

History

#1 Updated by Georg Ringer 15 days ago

  • Subject changed from ContentObjectRenderer->searchWhere will do exception with to short word. to ContentObjectRenderer->searchWhere will do exception with too short word.

Also available in: Atom PDF