Bug #6069

PdoBackend cannot handle uninitialized SplObjectStorage properties

Added by Karsten Dambekalns over 5 years ago. Updated almost 5 years ago.

Status:Resolved Start date:2010-01-18
Priority:Must have Due date:
Assigned To:Karsten Dambekalns % Done:

100%

Category:Persistence
Target version:TYPO3 Flow Base Distribution - 1.0 alpha 7
PHP Version: Complexity:
Has patch: Affected Flow version:

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 properties Resolved 2010-01-14

Associated revisions

Revision 62d0f1e0
Added by Karsten Dambekalns over 5 years ago

[+BUGFIX] FLOW3 (Persistence): PdoBackend can now handle NULL in properties declared as SplObjectStorage, fixes #6069. Applied the same fix for array processing.

History

#1 Updated by Karsten Dambekalns over 5 years ago

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

Applied in changeset r3653.

Also available in: Atom PDF