in2code-de / luxletter

Newsletter system for TYPO3
https://www.in2code.de/agentur/typo3-extensions/luxletter/
23 stars 25 forks source link

Call to undefined method Doctrine\DBAL\Driver\Mysqli\MysqliStatement::fetchOne() #109

Closed opi99 closed 2 years ago

opi99 commented 2 years ago

Selecting the Newsletter modul in backend results in the error message

Call to undefined method Doctrine\DBAL\Driver\Mysqli\MysqliStatement::fetchOne()

Doctrine DBAL in version 2.13.x doesn't know such a function, this was added in DBAL 3.x See https://github.com/doctrine/dbal/blob/2.13.x/lib/Doctrine/DBAL/Driver/ResultStatement.php

Using TYPO3 10.4.21 and Luxletter 9.0.x, the change comes from commit 923d67123fc4e0947839e4473733d23a97f42092 but also TYPO3 11 uses DBAL 2.13.x

einpraegsam commented 2 years ago

Thx for the feedback. I'm a bit confused, because we also set on the latest luxletter version on $domain (currently a TYPO3 10 with doctrine/dbal 2.11.3) and without any problems. I also checked dbal 2.11.3 on github and the function is already existing: https://github.com/doctrine/dbal/blob/2.11.3/lib/Doctrine/DBAL/Cache/ArrayStatement.php#L191

Any further information on this?

opi99 commented 2 years ago

ArrayStatement (you are linking) implements the ResultStatement Interface and have more functions defined as in the Interface exists.

So the question, why you get Cache ArrayStatement and I would say, you have another database configuration for this table as the "standard" mysqli.

einpraegsam commented 2 years ago

There is nothing beside the standard implementation:

$GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['driver'] = 'mysqli';

The link to ArrayStatement was just an example. If you search in DBAL project for "fetchOne()" there are a lot of results. In addition I cannot reproduce the issue in TYPO3 10 with DBAL 2.11.3. Does the error occures directly when you are opening the newsletter module? Or do you have to click another link after that to see the error?

opi99 commented 2 years ago
$ ~/projects/composer.phar outdated
[...]
doctrine/dbal                              2.10.4  2.13.4  Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management
[...]

Hmmm, 2.10.4 is the installed one ... and yes, it happens directly while clicking on Newsletter Module (and the Luxletter Dashboard should be come up).

einpraegsam commented 2 years ago

Can you please test with doctrine/dbal 2.11.0? If this problem is related to 2.10, I would add ^2.11 as dependency

opi99 commented 2 years ago

From TYPO3 v10 core composer.json

"doctrine/dbal": "~2.10.0 || ~2.11.2 || ~2.13.1",

See: https://github.com/doctrine/dbal/blob/2.11.0/lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php Yes, 2.11.0 is the fist version where MysqliStatement includes fetchOne function

opi99 commented 2 years ago

So dependency would be like "doctrine/dbal": "~2.11.2 || ~2.13.1",

einpraegsam commented 2 years ago

Thx for the feedback. Are you fine with the dependency change in luxletter composer.json file?

opi99 commented 2 years ago

Fine ... hmmm, can't update the doctrine part ... so I need to check an older version of luxletter (which should work for me). ;) So sure, updating composer.json should be fine.

einpraegsam commented 2 years ago

Thx for your time so far

opi99 commented 2 years ago

Thanks for your time. :)

linkpool commented 2 years ago

We have the same problem. We're using TYPO3 10.4.30 in a non-composer-environment.

typo3_src-10.4.30\vendor\doctrine\dbal\lib\Doctrine\DBAL VERSION = '2.10.4'

Call to undefined method Doctrine\DBAL\Driver\Mysqli\MysqliStatement::fetchOne()
in /data/www/sites/baden-wuerttemberg.de/releases/dummy/typo3conf/ext/luxletter/Classes/Domain/Repository/LogRepository.php line 32