Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP8 V11: fetch() deprecated #1819

Closed
aschmutt opened this issue Jul 10, 2022 · 4 comments
Closed

PHP8 V11: fetch() deprecated #1819

aschmutt opened this issue Jul 10, 2022 · 4 comments
Labels
Confirmed v12 Support for v12 + v11 only, no v10

Comments

@aschmutt
Copy link

aschmutt commented Jul 10, 2022

Bug Report

Current Behavior
With a new installation of TYPO3 V11 with PHP8.1 and all Warnings enabled, I get these Exceptions, for example with News Administration Module in Backend and List view in Frontend.

Bildschirmfoto 2022-07-10 um 17 25 58

PHP Runtime Deprecation Notice: PDOStatement::fetch(): Passing null to parameter #1 ($mode) of type int is deprecated in /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php line 138

Bildschirmfoto 2022-07-10 um 17 28 12

Expected behavior/output
No Exception

Environment

  • TYPO3 version(s): 11.5.12
  • news version: 9.4.0
  • Is your TYPO3 installation set up with Composer (Composer Mode): yes
  • OS: MacOS with ddev Setup

Possible Solution
replace all fetch() with fetchAssociative
This fixed my Exception:

class CategoryService, Line 103:
while (($row = $res->fetchAssociative())) {

Additional context
Searching in code showed more fetch() statements, so replacing all of them at once would be the best solution

@aschmutt
Copy link
Author

I will try to commit a patch

@georgringer
Copy link
Owner

thanks for creating this issue. I will change the requirements a bit because such propose changed is not possible because of support of v10

@aschmutt
Copy link
Author

@georgringer I am not sure about moving to V12?
I had a brand new V11 installation with more or less default settings in ddev, and even if it is just a deprecation warning, it blocks news completely in Backend and Frontend with this exception.
Unfortunately, deprecations throw now an Exception in Dev Environment, until you deactivate this behaviour, so more people might get this:
https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/Deprecation/Index.html

I used fetchAssociative already in V10 projects. I could not find out about fetchOne() and fetchAssociativeAll(), but if they are also available in V10, why not updating?

@georgringer
Copy link
Owner

yes, if you are using composer and use doctrine/dbal with 2.13 but if TYPO3 is installed by using tar files you won't get this version and no fetchAssociativeAll, ... is available

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Confirmed v12 Support for v12 + v11 only, no v10
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants