Project

General

Profile

Actions

Bug #65219

closed

Property-Mapping: ObjectStorageConverter fails if a child object is converted to NULL

Added by Jost Baron over 9 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2015-02-22
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
5.5
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

Hi!

A TypeConverter may return NULL, if the property it is asked to convert should not be converted. From the API documentation:

Actually convert from $source to $targetType, taking into account the fully built $convertedChildProperties and $configuration.

The return value can be one of three types:

 * an arbitrary object, or a simple type (which has been created while mapping). This is the normal case.
 * NULL, indicating that this object should not be mapped (i.e. a "File Upload" Converter could return NULL if no file has been uploaded, and a silent failure should occur.
 * An instance of – This will be a user-visible error message later on. Furthermore, it should throw an Exception if an unexpected failure (like a security error) occurred or a configuration issue happened.

However, if a TypeConverter returns NULL, and it converted an object which is to be placed into an ObjectStorage, this Exception is thrown:

  #1297759968: Exception while property mapping at property path "images":PHP Warning: spl_object_hash() expects parameter 1 to be object, null given in /home/jost/Projekte/Mein-Bauernhof/t3cores/typo3_src-6.2.10rc1/typo3/sysext/extbase/Classes/Persistence/ObjectStorage.php line 147

This is caused by the attach()-method of an object storage, which can not handle NULL values.

I'm not sure how to fix this. I see two ways: Making sure that NULL-values are already filtered out of the $convertedChildProperties parameter for TypeConverters, or adding a check for NULL in the ObjectStorageTypeConverter.

Actions

Also available in: Atom PDF