Bug #102278
closed
Missing default value for property Container.php:$prototypeObjectsWhichAreCurrentlyInstanciated will lead to #1546632293 RuntimeException in GenericObjectValidator.php
Added by Tobi Ferger 11 months ago.
Updated 2 months ago.
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 to Bug #95819: Extbase does not support uninitialized domain object properties added
- Related to Bug #97646: Extbase property mapper does not work with uninitialized properties added
- Related to Task #95326: Do not use custom "getInstance()" methods on Singleton interfaces added
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
- Status changed from New to Under Review
In TYPO3 11 the method must be named
initializeObject
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
- Status changed from Resolved to Closed
Also available in: Atom
PDF