ZF2-438: Autoloading error while passing string value as call time user param to Di::newInstance for typeless parameter

Description

Preconditons: - Include path autoloader is registered - RuntimeDefinition is used - class with typeless constructor parameter exists Example:


class A
{
    public function __construct($someParam)
    {
    }
}
  • New A instance is requested like:

$di->newInstance('A', array('someParam' => 'someValue')

Expected Result: New instance is created with $someParam = 'someValue'

Actual Result: Fatal error: require() [function.require]: Failed opening required 'someValue.php'

Comments

This issue appears because runtime definition sets type of a typeless parameter to null.

While Di::resolveMethodParameters checks for $type==false in line 531. Only parameters with type === false are considered string parameters. All other parameters are considered class names/aliases.

Maybe it would be better to perceive string values as aliases/class names only for type hinted parameters?

This issue has been closed on Jira and moved to GitHub for issue tracking. To continue following the resolution of this issues, please visit: https://github.com/zendframework/zf2/issues/2512