Project

General

Profile

Actions

Bug #102278

closed

Missing default value for property Container.php:$prototypeObjectsWhichAreCurrentlyInstanciated will lead to #1546632293 RuntimeException in GenericObjectValidator.php

Added by Tobi Ferger 6 months ago. Updated 22 days ago.

Status:
Resolved
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2023-10-27
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
11
PHP Version:
7.4
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

In the class TYPO3\CMS\Extbase\Object\Container\Container.php the declaration of property $prototypeObjectsWhichAreCurrentlyInstanciated lacks of default value "empty array".
This leads to #1546632293 RuntimeException in Extbase/Validation/Validator/GenericObjectValidator.php:72 when e.g. reflection service try to access an uninitialized property like you have in models with an objectstorage property instanciated via constructor when they are defined as nullable.

change TYPO3\CMS\Extbase\Object\Container\Container.php:75:
private $prototypeObjectsWhichAreCurrentlyInstanciated;
to
private $prototypeObjectsWhichAreCurrentlyInstanciated = [];
to fix.


Related issues 3 (0 open3 closed)

Related to TYPO3 Core - Bug #95819: Extbase does not support uninitialized domain object propertiesClosedAlexander Schnitzler2021-10-30

Actions
Related to TYPO3 Core - Bug #97646: Extbase property mapper does not work with uninitialized propertiesClosedSascha Egerer2022-05-17

Actions
Related to TYPO3 Core - Task #95326: Do not use custom "getInstance()" methods on Singleton interfacesClosedBenni Mack2021-09-23

Actions
Actions #1

Updated by Tobi Ferger 6 months ago

  • Related to Bug #95819: Extbase does not support uninitialized domain object properties added
Actions #2

Updated by Tobi Ferger 6 months ago

  • Related to Bug #97646: Extbase property mapper does not work with uninitialized properties added
Actions #4

Updated by Christian Weiske 24 days ago

  • Related to Task #95326: Do not use custom "getInstance()" methods on Singleton interfaces added
Actions #5

Updated by Christian Weiske 24 days ago

We see this bug on TYPO3 11.5.33.

In TYPO3 v10, getInstance() was called which initialized the default empty array value. With symfony dependency injection since #84112 this method does not get called anymore.

Stack trace:

(1/1) TypeError
array_key_exists(): Argument #2 ($array) must be of type array, null given
in /var/www/html/web/typo3/sysext/extbase/Classes/Object/Container/Container.php line 171

at array_key_exists()
in /var/www/html/web/typo3/sysext/extbase/Classes/Object/Container/Container.php line 171

at TYPO3\CMS\Extbase\Object\Container\Container->getInstanceInternal()
in /var/www/html/web/typo3/sysext/extbase/Classes/Object/Container/Container.php line 226

at TYPO3\CMS\Extbase\Object\Container\Container->injectDependencies()
in /var/www/html/web/typo3/sysext/extbase/Classes/Object/Container/Container.php line 130

at TYPO3\CMS\Extbase\Object\Container\Container->getEmptyObject()
in /var/www/html/web/typo3/sysext/extbase/Classes/Object/ObjectManager.php line 138

at TYPO3\CMS\Extbase\Object\ObjectManager->getEmptyObject()
in /var/www/html/web/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapper.php line 171

at TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper->createEmptyObject()
in /var/www/html/web/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapper.php line 144

Actions #6

Updated by Gerrit Code Review 24 days ago

  • Status changed from New to Under Review

Patch set 1 for branch 11.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/+/83707

Actions #7

Updated by Gerrit Code Review 24 days ago

Patch set 2 for branch 11.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/+/83707

Actions #8

Updated by Gerrit Code Review 24 days ago

Patch set 3 for branch 11.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/+/83707

Actions #9

Updated by Simon Schaufelberger 23 days ago

In TYPO3 11 the method must be named
initializeObject

Actions #10

Updated by Anonymous 22 days ago

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

Also available in: Atom PDF