Issue Bug Closed

#76202Exception when accessing empty ObjectStorage property (frontend form submitting)

Martin Weymayer 05/16/16, 20:15 updated 09/02/26, 14:28

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

History 610

  1. Martin Weymayer commented <span data-processor="relativetime" data-value="2016-05-17T07:48:20+00:00" > 05/17/16, 07:48 </span>

    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;
            }
  2. Martin Weymayer commented <span data-processor="relativetime" data-value="2016-10-11T11:49:54+00:00" > 10/11/16, 11:49 </span>

    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);
    }
  3. Eike Starkmann commented <span data-processor="relativetime" data-value="2017-05-02T18:05:37+00:00" > 05/02/17, 18:05 </span>

    I also experienced this issue.

    Also all references attached to the object are lost afterwards.

  4. Georg Ringer commented and changed status Under Review Closed <span data-processor="relativetime" data-value="2026-09-02T14:28:01+00:00" > 09/02/26, 14:28 </span>

    solved with #100797