#76202Exception when accessing empty ObjectStorage property (frontend form submitting)
Description
hi,
seems bug from 6.2 version https://forge.typo3.org/issues/62553 is still in typo3 7.6 version. i have a form where following select field is:
<f:form property="anfragen.0.bundesland." id="bundesland" options="{xxxx}" optionvaluefield="uid" optionlabelfield="bundesland" prependoptionlabel="alle Bundesländer" prependoptionvalue></f:form>
if i submit form and do not select any “bundesland” following error is shown:
#1297759968: Exception while property mapping at property path “anfragen.0.bundesland”: PHP Warning: spl_object_hash() expects parameter 1 to be object, null given in /home/kundenhost/public_html/xxx/typo3/sysext/extbase/Classes/Persistence/ObjectStorage.php line 155
here some info from exeption:
#1297759968: Exception while property mapping at property path “anfragen.0.bundesland”: PHP Warning: spl_object_hash() expects parameter 1 to be object, null given in /home/kundenhost/public_html/xxxxxs/typo3/sysext/extbase/Classes/Persistence/ObjectStorage.php line 155 (More information)
TYPO3\CMS\Extbase\Property\Exception thrown in file
/home/kundenhost/public_html/xxxxxs/typo3/sysext/extbase/Classes/Property/PropertyMapper.php in line 128.
21 TYPO3\CMS\Extbase\Property\PropertyMapper::convert(array, “Xxxxxx\Mwxxxxxs\Domain\Model\aaaaaaa”, TYPO3\CMS\Extbase\Mvc\Controller\MvcPropertyMappingConfiguration)
/home/kundenhost/public_html/xxxxxs/typo3/sysext/extbase/Classes/Mvc/Controller/Argument.php:
00268: }
00269: try {
00270: $this->value = $this->propertyMapper->convert($rawValue, $this->dataType, $this->propertyMappingConfiguration);
00271: } catch (TargetNotFoundException $e) {
00272: // for optional arguments no exeption is thrown.
20 TYPO3\CMS\Extbase\Mvc\Controller\Argument::setValue(array)
/home/kundenhost/public_html/xxxxxs/typo3/sysext/extbase/Classes/Mvc/Controller/AbstractController.php:
00426: $argumentName = $argument->getName();
00427: if ($this->request->hasArgument($argumentName)) {
00428: $argument->setValue($this->request->getArgument($argumentName));
00429: } elseif ($argument->isRequired()) {
00430: throw new \TYPO3\CMS\Extbase\Mvc\Controller\Exception\RequiredArgumentMissingException(‘Required argument “’ . $argumentName . ‘” is not set for ‘ . $this->request->getControllerObjectName() . ‘->’ . $this->request->getControllerActionName() . ‘.’, 1298012500);
19 TYPO3\CMS\Extbase\Mvc\Controller\AbstractController::mapRequestArgumentsToControllerArguments()
/home/kundenhost/public_html/xxxxxs/typo3/sysext/extbase/Classes/Mvc/Controller/ActionController.php:
00168: call_user_func(array($this, $actionInitializationMethodName));
00169: }
00170: $this->mapRequestArgumentsToControllerArguments();
00171: $this->controllerContext = $this->buildControllerContext();
00172: $this->view = $this->resolveView();
Reviews 1
Related issues 1
History 610
-
Martin Weymayer commented 05/17/16, 07:48
-
Martin Weymayer commented 10/11/16, 11:49
better solution found – so no core hack necessary:
/** * initialize createanfrage action * * @param void
*/
public function initializeCreateanfrageAction() {$arguments = $this->request->getArguments();
if (intval($arguments[‘newAnfrage’][‘bundesland’]0) = 0) {
unset($arguments['newAnfrage']['bundesland']);
}
if (intval($arguments['newAnfrage']['regionen'][0]) = 0) {
unset($arguments[‘newAnfrage’][‘regionen’]);
}$this->request->setArguments($arguments);} -
Eike Starkmann commented 05/02/17, 18:05
I also experienced this issue.
Also all references attached to the object are lost afterwards.
-
Riccardo De Contardi changed category 09/18/18, 16:24
-
Gerrit Code Review pushed patch set 1 for main to change 95440 status
NewUnder Review 08/26/26, 22:30 -
Gerrit Code Review pushed patch set 2 for main to change 95440 08/27/26, 06:52
-
Gerrit Code Review pushed patch set 3 for main to change 95440 08/27/26, 06:59
-
Gerrit Code Review pushed patch set 4 for main to change 95440 08/27/26, 07:00
-
Georg Ringer commented and changed status
Under ReviewClosed 09/02/26, 14:28solved with #100797
-
Georg Ringer changed Related to #100797 09/02/26, 14:28
i solved this for me with following code in typo3/sysext/extbase/Classes/Persistence/ObjectStorage.php line 155 – it seems working:
if(is_object($object)) { $this->isModified = true; $this->storage[spl_object_hash($object)] = array('obj' => $object, 'inf' => $information); $this->positionCounter++; $this->addedObjectsPositions[spl_object_hash($object)] = $this->positionCounter; }