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

Closed
wants to merge 2 commits into
from

Projects

None yet

3 participants

@coolmic
Contributor
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.

@weierophinney weierophinney commented on an outdated diff Aug 19, 2013
library/Zend/ModuleManager/Listener/ServiceListener.php
@@ -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))
@weierophinney
weierophinney Aug 19, 2013 Member

This needs to be wrapped in parens to work.

@coolmic
Contributor
coolmic commented Aug 21, 2013

I didn't know about this convention.

@Ocramius
Member

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

@weierophinney
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 weierophinney added a commit that referenced this pull request Aug 21, 2013
@weierophinney weierophinney Merge branch 'hotfix/4957' into develop
Forward port #4957
5fd00ea
@weierophinney weierophinney added a commit that closed this pull request Aug 21, 2013
@weierophinney weierophinney Merge branch 'hotfix/4957'
Close #4957
3163aa2
@weierophinney
Member

Cherry-picked to master for release with 2.2.3.

@weierophinney weierophinney added a commit to zendframework/zend-modulemanager that referenced this pull request May 15, 2015
@weierophinney weierophinney Merge branch 'hotfix/4957' 62f83fa
@weierophinney weierophinney added a commit to zendframework/zend-modulemanager that referenced this pull request May 15, 2015
@weierophinney weierophinney Merge branch 'hotfix/4957' into develop 0b5ec15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment