Project

General

Profile

Actions

Bug #92520

closed

DBAL-DriverException in BE module SYSTEM->"Backend users" when searching by username on PostgreSQL

Added by Stephan Großberndt about 4 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Must have
Category:
Database API (Doctrine DBAL)
Target version:
-
Start date:
2020-10-08
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
easy
Is Regression:
Sprint Focus:

Description

Just found a bug in TYPO3 backend module SYSTEM->Backend users when using PostgreSQL. If you enter any text in the filter text field "Username" and send the search you get a Doctrine\DBAL\Exception\DriverException.

This happens because of
typo3/sysext/beuser/Classes/Domain/Repository/BackendUserRepository.php:

            $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('be_users');
            foreach (['userName', 'uid', 'realName'] as $field) {
                $searchConstraints[] = $query->like(
                    $field,
                    '%' . $queryBuilder->escapeLikeWildcards($demand->getUserName()) . '%'
                );
            }
            $constraints[] = $query->logicalOr($searchConstraints);

which searches for uid (an int column) using LIKE which probably will fail on MSSQL and SQLite too. There is no direct replacement which is database platform agnostic to my knowledge.

As discussed on Slack we simply go for $constraints[] = $query->equals('uid', (int)$demand->getUserName()); instead to only directly show backend user 4 when searching for 4 instead of showing 4 and 14.

Actions

Also available in: Atom PDF