Project

General

Profile

Actions

Bug #92376

closed

Doctrine 2.11.x breaks prepared parameters

Added by Tizian Schmidlin over 3 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
-
Start date:
2020-09-22
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
no-brainer
Is Regression:
Sprint Focus:

Description

Hello there,

we ran into an issue with Doctrine DBAL in the last two days.

Since 2.11 of doctrine/dbal prepared statements lead to issues regarding prepared statements where mysql simply isn't able to apply the parameters for some reason.

Until 2.10.4 it works fine.

Reproducible with powermail and an internal extension, both using Extbase with queries like these:

$query->equals('field.relation.someotherrelation', 'my param')

It all seems to be the same problem:
  1. Generation of empty where statements

For the moment we fixated the version of dbal to 2.10.*, I guess this should be done in the core by default, too.

Reproducible in 10.4 and 9.5


Files

ArgumentCountError.png (186 KB) ArgumentCountError.png Christopher Schnell, 2020-09-23 11:12

Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Bug #92865: 10.4.10 breaks compatibility with doctrine/dbal 2.12Closed2020-11-17

Actions
Has duplicate TYPO3 Core - Bug #92515: Limit DBAL of Core 9 and 10 to 2.10ClosedMarkus Klein2020-10-08

Actions
Actions #1

Updated by Georg Ringer over 3 years ago

  • Status changed from New to Needs Feedback
Actions #2

Updated by Tizian Schmidlin over 3 years ago

This definitely looks like it would be solved by 2.11.1 but as long as it is not released, I'm not too keen to try it in removing the restriction in the project composer.json.

We'll test it today and come back at you.

Best Regards

Actions #3

Updated by Christopher Schnell over 3 years ago

We tried
"doctrine/dbal": "2.11.x-dev#0325f424ae9d85d5085b6ebe13bae13c84bea9cb", (includes the mentioned pull request)
and
"doctrine/dbal": "2.11.x-dev",

Both versions now result in an
ArgumentCountError
Too few arguments to function Doctrine\DBAL\Query\Expression\CompositeExpression::with(), 0 passed in /var/www/vendor/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php on line 837 and exactly 1 expected

I have added a screenshot of the first part of the stack trace.

Actions #4

Updated by Ayke Halder over 3 years ago

I can confirm this for:

  • TYPO3-Version: 9.5.21
  • Webserver: Apache/2.4.38 (Debian)
  • PHP-Version: 7.3.20-1+0~20200710.65+debian10~1.gbpc9cbeb
  • Datenbank (Default): MySQL 5.5.5-10.2.32-MariaDB-1:10.2.32+maria~bionic-log
  • Application context: Development
  • Composer-Mode: active
  • Operating system: Linux 5.7.0-0.bpo.2-amd64
  • Extension in stack trace: apache-solr-for-typo3/solr 9.0.2

Steps to reproduce

composer update

  • Updating doctrine/dbal (2.10.4 => 2.11.1)

Workaround

  • Downgrading doctrine/dbal (2.11.1 => 2.10.4)

Stack trace

(1/1) ArgumentCountError

Too few arguments to function Doctrine\DBAL\Query\Expression\CompositeExpression::with(), 0 passed in /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php on line 837 and exactly 1 expected
in /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Query/Expression/CompositeExpression.php line 119

     *
     * @param self|string $part
     * @param self|string ...$parts
     */
    public function with($part, ...$parts): self
    {
        $that = clone $this;

        $that->parts[] = $part;

at Doctrine\DBAL\Query\Expression\CompositeExpression->with()
in /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php line 837

        $args  = array_filter($args); // https://github.com/doctrine/dbal/issues/4282
        $where = $this->getQueryPart('where');

        if ($where instanceof CompositeExpression && $where->getType() === CompositeExpression::TYPE_AND) {
            $where = $where->with(...$args);
        } else {
            array_unshift($args, $where);
            $where = CompositeExpression::and(...$args);
        }

at Doctrine\DBAL\Query\QueryBuilder->andWhere(object(Doctrine\DBAL\Query\Expression\CompositeExpression))
in /var/www/html/public/typo3/sysext/core/Classes/Database/Query/QueryBuilder.php line 653

     * @see where()
     */
    public function andWhere(...$where): QueryBuilder
    {
        $this->concreteQueryBuilder->andWhere(...$where);

        return $this;
    }

at TYPO3\CMS\Core\Database\Query\QueryBuilder->andWhere('')
in /var/www/html/public/typo3/sysext/frontend/Classes/Page/PageRepository.php line 355

            );

        $originalWhereGroupAccess = '';
        if (!$disableGroupAccessCheck) {
            $queryBuilder->andWhere(QueryHelper::stripLogicalOperatorPrefix($this->where_groupAccess));
        } else {
            $originalWhereGroupAccess = $this->where_groupAccess;
            $this->where_groupAccess = '';
        }

at TYPO3\CMS\Frontend\Page\PageRepository->getPage(10213)
in /var/www/html/public/typo3conf/ext/solr/Classes/Access/Rootline.php line 162

            }
        }

        // current page
        $currentPageRecord = $pageSelector->getPage($pageId);
        if ($currentPageRecord['fe_group']) {
            $accessRootline->push(GeneralUtility::makeInstance(
                RootlineElement::class,
                /** @scrutinizer ignore-type */ $currentPageRecord['uid'] . RootlineElement::PAGE_ID_GROUP_DELI
Actions #5

Updated by Anonymous over 3 years ago

Reproducible with 9.5.22 as well.
The query I found is like mentioned above in EXT:powermail v7.4.0 FieldRepository.

$query = $this->createQuery();
        $query->getQuerySettings()->setRespectStoragePage(false);
        $query->getQuerySettings()->setRespectSysLanguage(false);
        $query->matching(
            $query->logicalAnd(
                [
                    $query->equals('marker', $marker),
                    $query->equals('pages.forms.uid', $formUid)
                ]
            )
        );
        $query->setLimit(1);
        $result = $query->execute()->getFirst();

Downgrading doctrine/dbal to "~2.10.0" fixes it.

Actions #6

Updated by Markus Klein over 3 years ago

  • Has duplicate Bug #92515: Limit DBAL of Core 9 and 10 to 2.10 added
Actions #7

Updated by Markus Klein over 3 years ago

  • Status changed from Needs Feedback to Accepted
  • Assignee set to Markus Klein
  • TYPO3 Version changed from 10 to 9
Actions #8

Updated by Gerrit Code Review over 3 years ago

  • Status changed from Accepted to Under Review

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/+/66081

Actions #9

Updated by Gerrit Code Review over 3 years ago

Patch set 2 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/+/66081

Actions #10

Updated by Gerrit Code Review over 3 years ago

Patch set 3 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/+/66081

Actions #11

Updated by Gerrit Code Review over 3 years ago

Patch set 4 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/+/66081

Actions #12

Updated by varioous OG over 3 years ago

Can also confirm that on 9.5.22.

Downgrading works.

"doctrine/dbal": "2.10.4" 
Actions #13

Updated by Gerrit Code Review over 3 years ago

Patch set 5 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/+/66081

Actions #14

Updated by Gerrit Code Review over 3 years ago

Patch set 6 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/+/66081

Actions #15

Updated by Gerrit Code Review over 3 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/+/66253

Actions #16

Updated by Markus Klein over 3 years ago

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

Updated by Oliver Hader over 3 years ago

  • Related to Bug #92865: 10.4.10 breaks compatibility with doctrine/dbal 2.12 added
Actions #18

Updated by Benni Mack over 3 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF