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 #1

Updated by Stephan Großberndt about 4 years ago

  • Description updated (diff)
Actions #2

Updated by Gerrit Code Review about 4 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/66087

Actions #3

Updated by Gerrit Code Review about 4 years ago

Patch set 1 for branch 10.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/66118

Actions #4

Updated by Gerrit Code Review about 4 years ago

Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/66119

Actions #5

Updated by Stephan Großberndt about 4 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #6

Updated by Benni Mack almost 4 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF