Bug #6069

PdoBackend cannot handle uninitialized SplObjectStorage properties

Added by Karsten Dambekalns about 11 years ago. Updated over 10 years ago.

Status:
Resolved
Priority:
Must have
Category:
Persistence
Start date:
2010-01-18
Due date:
% Done:

100%

Estimated time:
PHP Version:
Has patch:
Complexity:

Description

Properties with a declared type of SplObjectStorage that have a NULL value break persistence.

Zachary Davis

In my application, I have two models: accounts and users. Account models have a property like this:

/**
  * @var \SplObjectStorage<\F3\MyApp\Domain\Model\User>
  */
 protected $users;

Prior to upgrading the FLOW3 source, I was able to persist Account objects without setting the $users property. After upgrading, attempts to persist accounts fail with this error:

#1: Catchable Fatal Error: Argument 1 passed to F3\FLOW3\Persistence\Backend\PdoBackend::processSplObjectStorage() must be an instance of SplObjectStorage, null given, called in /opt/local/apache2/htdocs/tutorial/Packages/Framework/FLOW3/Classes/Persistence/Backend/PdoBackend.php on line 247 and defined in /opt/local/apache2/htdocs/tutorial/Packages/Framework/FLOW3/Classes/Persistence/Backend/PdoBackend.php line 388 (More information)

For now, I've fixed it by setting users to an empty SplObjectStorage instance in the User constructor.


Related issues

Related to TYPO3.Flow - Bug #6029: PdoBackend cannot handle uninitialized DateTime propertiesResolvedKarsten Dambekalns2010-01-14

Actions
#1

Updated by Karsten Dambekalns about 11 years ago

  • Status changed from Accepted to Resolved
  • % Done changed from 0 to 100

Applied in changeset r3653.

Also available in: Atom PDF