Bug #47809

Access to undefined index when an inheritance chain member is not an Entity

Added by Adrian Föder over 2 years ago. Updated about 1 year ago.

Status:Resolved Start date:2013-05-02
Priority:Should have Due date:
Assigned To:Adrian Föder % Done:

100%

Category:Reflection
Target version:TYPO3 Flow Base Distribution - 2.0.1
PHP Version: Complexity:
Has patch:No Affected Flow version:Git master

Description

It comes to an exception like this,

#1355480641: Uncaught Exception Notice: Undefined index: TYPO3\Media\Domain\Model\ImageVariant in Packages\Framework\TYPO3.Flow\Classes\TYPO3\Flow\Reflection\ReflectionService.php line 1461

This is because of these lines,

1    protected function makeChildClassesAggregateRoot(\TYPO3\Flow\Reflection\ClassSchema $classSchema) {
2        foreach ($this->getAllSubClassNamesForClass($classSchema->getClassName()) as $childClassName) {
3            if ($this->classSchemata[$childClassName]->isAggregateRoot()) {
4                continue;

In the given case, the ImageVariant inheritance looks like the following:

Asset (@Entity)
  - SizedAsset (@Entity)
    - ImageVariant (NOT an @Entity!)

The above mentioned method searches in ->classSchemata for the ImageVariant, but as of convention, classSchemata is "Schemata of all classes which can be persisted", so ImageVariant is not there of course, leading to the exception.

Associated revisions

Revision 4c520789
Added by Adrian Föder over 2 years ago

[BUGFIX] ReflectionService works for non-Entity inheritance members

As soon as a class which is not an entity was present as an
ancestor of an Entity (with at least one Entity descendant in
between), there was an Undefined Index error because the
ReflectionService proceeded on the assumption that everything
was an Entity, hence present in the ->classSchemata array.

This adds an additional check for the actual presence of
such an array index and proofs this behavior with a
Functional Test Fixture.

Fixes: #47809
Releases: master, 2.0
Change-Id: I12118004e60e2230a7021a73251ea7c57d660d3b

Revision be7b184a
Added by Adrian Föder almost 2 years ago

[BUGFIX] ReflectionService works for non-Entity inheritance members

As soon as a class which is not an entity was present as an
ancestor of an Entity (with at least one Entity descendant in
between), there was an Undefined Index error because the
ReflectionService proceeded on the assumption that everything
was an Entity, hence present in the ->classSchemata array.

This adds an additional check for the actual presence of
such an array index and proofs this behavior with a
Functional Test Fixture.

Fixes: #47809
Releases: master, 2.0
Change-Id: I12118004e60e2230a7021a73251ea7c57d660d3b

History

#1 Updated by Adrian Föder over 2 years ago

  • Status changed from New to Accepted

#2 Updated by Gerrit Code Review over 2 years ago

  • Status changed from Accepted to Under Review

Patch set 2 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/20402

#3 Updated by Robert Lemke about 2 years ago

  • Priority changed from Must have to Should have
  • Target version set to 2.0

#4 Updated by Karsten Dambekalns almost 2 years ago

  • Target version changed from 2.0 to 2.0.1

#5 Updated by Gerrit Code Review almost 2 years ago

Patch set 1 for branch 2.0 has been pushed to the review server.
It is available at https://review.typo3.org/24033

#6 Updated by Adrian Föder about 1 year ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF