When using this component standalone and dumping the container, the aliases are not set to the default value of $this->aliases = array(). If now calling $container->has() it is checked if $this->alias has a key: array_key_exists($id, $this->aliases). array_key_exists needs an array as second parameter what won't be set if no aliases are set during the container build process. So instead of returning an empty string, returning the initialization value helps to avoid this error.

A PR has been created on github for the component, but if you don't want to use the newest version or wait until it comes out, you can add the patch provided.

Comments

mikelohmann’s picture

Assigned: mikelohmann » Unassigned
sylvain lecoy’s picture

Ok mikelohmann,

For the sake of tracability, can you provide the link of the PR ?

I let you informed within the week.

Thanks

sylvain lecoy’s picture

I could not apply your patch but I pushed this in dev: http://drupalcode.org/project/dependencyinjection.git/commit/6d0cb08.

Can you confirm this work ?

sylvain lecoy’s picture

Status: Needs review » Closed (fixed)

I guess this is now fixed.