Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Undefined variable: class in Zend/ModuleManager/Listener/ServiceListener.php #4957

Conversation

coolmic
Copy link
Contributor

@coolmic coolmic commented Aug 13, 2013

How to reproduce error :

Add in config

array(
    'controller_plugins' => array(
        'configuration_classes' => array(
            'My\Unfound\Controller\PluginConfig'
        )
    ),
);

Well, it's a little useless because I fix an error, that occur on fatal error, but the exception message is at least more readable.

@@ -244,7 +244,7 @@ protected function serviceConfigToArray($config)
if (!$config instanceof ServiceConfig) {
throw new Exception\RuntimeException(sprintf(
'Invalid service manager configuration class provided; received "%s", expected an instance of Zend\ServiceManager\Config',
$class
is_object($config) ? get_class($config) : (is_scalar($config) ? $config : gettype($config))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be wrapped in parens to work.

@coolmic
Copy link
Contributor Author

coolmic commented Aug 21, 2013

I didn't know about this convention.

@Ocramius
Copy link
Member

@coolmic I think @weierophinney simply didn't see a comma

@weierophinney
Copy link
Member

@Ocramius Actually, no, it was a syntax issue. Parens are needed if you use a ternary to return a value as part of an function/method argument; I know, because I got bit by it some time back. :)

weierophinney added a commit that referenced this pull request Aug 21, 2013
@ghost ghost assigned weierophinney Aug 21, 2013
@weierophinney
Copy link
Member

Cherry-picked to master for release with 2.2.3.

weierophinney added a commit to zendframework/zend-modulemanager that referenced this pull request May 15, 2015
weierophinney added a commit to zendframework/zend-modulemanager that referenced this pull request May 15, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants