Bug #10678

ReflectionService doesn't reflect methods of child classes correctly when they get reflected before their parent class in the initialization process

Added by Florian Kugler over 4 years ago. Updated almost 4 years ago.

Status:New Start date:2010-11-08
Priority:Must have Due date:
Assigned To:- % Done:

0%

Category:Reflection
Target version:-
PHP Version: Complexity:
Has patch: Affected Flow version:FLOW3 1.0.0

Description

ReflectionService::reflectClass() calls $this->convertParameterReflectionToArray() to reflect the parameters of a method which in turn calls $this->getMethodTagsValues() to retrieve the type hint for the parameter.
However, if a child class gets reflected in the initialization process of ReflectionService before its parent class got reflected, the type hint information for parameters of inherited methods is not detected.

ReflectionService::convertParameterReflectionToArray() tries to retrieve the type hint from the reflection information of the declaring (in this case: parent) class by calling

$methodTagsAndValues = $this->getMethodTagsValues($method->getDeclaringClass()->getName(), $method->getName());

If the declaring class did not get reflected until this point ReflectionService::getMethodTagsValues() returns an empty array.

getMethodTagsValues() only calls reflectClass() on a not yet reflected class it is queried about if the initialization process of the ReflectionService is already finished, because of this statement:
if ($this->initialized === TRUE && !isset($this->reflectedClassNames[$className])) $this->reflectClass($className);

For me removing the $this->initialized === TRUE condition in getMethodTagsValues() solved the problem. But I'm not sure if it might brake things somewhere else!?

History

#1 Updated by Karsten Dambekalns almost 4 years ago

  • Affected Flow version set to FLOW3 1.0.0

Also available in: Atom PDF