Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined index: __request #1677

Closed
shefik opened this issue Apr 23, 2014 · 14 comments
Closed

Undefined index: __request #1677

shefik opened this issue Apr 23, 2014 · 14 comments
Labels
Milestone

Comments

@shefik
Copy link
Contributor

shefik commented Apr 23, 2014

I keep getting this error on a clean install of Zikula

ContextErrorException: Notice: Undefined index: __request in /src/lib/legacy/Zikula/ServiceManager.php line 114

@cmfcmf
Copy link
Contributor

cmfcmf commented Apr 23, 2014

I've also seen this error. However I'm not entirely sure the way you fix it in your PR is the intended way. I also don't know why the request is handled in such a way, maybe @Drak knows more about it?

@cmfcmf
Copy link
Contributor

cmfcmf commented Apr 23, 2014

That's how my workaround looked like (however I'm not sure what exactly is going on there)

 if ($id === 'request' && isset($GLOBALS['__request'])) {
      return $GLOBALS['__request'];
 }

@ghost
Copy link

ghost commented Apr 23, 2014

I think the PR is wrong. We're trying to wire in Symfony's way of doing things. That means we inject the request from the front controller only so using Request::create arbitrarily in the code is not ok really. (because of subrequests).

@shefik
Copy link
Contributor Author

shefik commented Apr 24, 2014

@Drak So, are you saying the correct code should be what @cmfcmf posted above? If so, then why isn't $GLOBALS['__request'] already available, if it's being set in the init function? It looks like somewhere, code is calling to retrieve $GLOBALS['__request'] prior to init, so it's apparently needed.

@craigh
Copy link
Member

craigh commented May 17, 2014

I am also getting this error locally whereas a few months ago I was not. Every time the session is restarted I get it.

@craigh craigh added this to the 1.4.0 milestone May 23, 2014
@craigh
Copy link
Member

craigh commented May 23, 2014

I see this error also when doing a composer update

Compiling component files
PHP Notice: Undefined index: __request in /home/ntq/public_html/core/src/lib/legacy/Zikula/ServiceManager.php on line 114
Clearing the cache for the dev environment with debug true
PHP Notice: Undefined index: __request in /home/ntq/public_html/core/src/lib/legacy/Zikula/ServiceManager.php on line 114
Installing assets using the hard copy option

@craigh
Copy link
Member

craigh commented May 24, 2014

there is some similar code already here: https://github.com/zikula/core/blob/1.4/src/lib/legacy/Zikula/Core.php#L406

@craigh
Copy link
Member

craigh commented May 24, 2014

for the record, here is the full trace:

in /Applications/MAMP/htdocs/core.git/src/lib/legacy/Zikula/ServiceManager.php line 114
at ErrorHandler->handle('8', 'Undefined index: __request', '/Applications/MAMP/htdocs/core.git/src/lib/legacy/Zikula/ServiceManager.php', '114', array('id' => 'request', 'invalidBehavior' => '2')) in /Applications/MAMP/htdocs/core.git/src/lib/legacy/Zikula/ServiceManager.php line 114
at Zikula_ServiceManager->get('request', '2') in /Applications/MAMP/htdocs/core.git/src/app/cache/dev/appDevDebugProjectContainer.php line 434
at appDevDebugProjectContainer->getCmfRouting_DynamicRouterService() in /Applications/MAMP/htdocs/core.git/src/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php line 312
at Container->get('cmf_routing.dynamic_router', '1') in /Applications/MAMP/htdocs/core.git/src/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php line 464
at ContainerBuilder->get('cmf_routing.dynamic_router', '1') in /Applications/MAMP/htdocs/core.git/src/lib/legacy/Zikula/ServiceManager.php line 117
at Zikula_ServiceManager->get('cmf_routing.dynamic_router') in /Applications/MAMP/htdocs/core.git/src/app/cache/dev/appDevDebugProjectContainer.php line 534
at appDevDebugProjectContainer->getCmfRouting_RouterService() in /Applications/MAMP/htdocs/core.git/src/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php line 312
at Container->get('cmf_routing.router', '1') in /Applications/MAMP/htdocs/core.git/src/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php line 464
at ContainerBuilder->get('cmf_routing.router', '1') in /Applications/MAMP/htdocs/core.git/src/lib/legacy/Zikula/ServiceManager.php line 117
at Zikula_ServiceManager->get('cmf_routing.router') in /Applications/MAMP/htdocs/core.git/src/app/cache/dev/appDevDebugProjectContainer.php line 419
at appDevDebugProjectContainer->getCacheWarmerService() in /Applications/MAMP/htdocs/core.git/src/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php line 312
at Container->get('cache_warmer', '1') in /Applications/MAMP/htdocs/core.git/src/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php line 464
at ContainerBuilder->get('cache_warmer', '1') in /Applications/MAMP/htdocs/core.git/src/lib/legacy/Zikula/ServiceManager.php line 117
at Zikula_ServiceManager->get('cache_warmer') in /Applications/MAMP/htdocs/core.git/src/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php line 571
at Kernel->initializeContainer() in /Applications/MAMP/htdocs/core.git/src/lib/Zikula/Bundle/CoreBundle/HttpKernel/ZikulaKernel.php line 299
at ZikulaKernel->initializeContainer() in /Applications/MAMP/htdocs/core.git/src/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php line 128
at Kernel->boot() in /Applications/MAMP/htdocs/core.git/src/lib/Zikula/Bundle/CoreBundle/HttpKernel/ZikulaKernel.php line 86
at ZikulaKernel->boot() in /Applications/MAMP/htdocs/core.git/src/lib/bootstrap.php line 33
at include('/Applications/MAMP/htdocs/core.git/src/lib/bootstrap.php') in /Applications/MAMP/htdocs/core.git/src/index.php line 16

@phaidon
Copy link
Contributor

phaidon commented May 25, 2014

I have this error too.

The installer does not work anymore, because of this.

@cmfcmf
Copy link
Contributor

cmfcmf commented May 25, 2014

The error will be gone once my Routing PR is finished. For now you can use the workaround mentioned above.

@craigh
Copy link
Member

craigh commented May 25, 2014

The installer may have completed successfully but leaves this error at the end?

@craigh craigh closed this as completed May 25, 2014
@craigh craigh reopened this May 25, 2014
@phaidon
Copy link
Contributor

phaidon commented May 25, 2014

@cmfcmf the work around helps, but now I get

ORMInvalidArgumentException: EntityManager#persist() expects parameter 1 to be an entity object, NULL given.
in Zikula/src/vendor/doctrine/orm/lib/Doctrine/ORM/ORMInvalidArgumentException.php line 169

but maybe this is another problem.

@cmfcmf
Copy link
Contributor

cmfcmf commented May 25, 2014

That's something different.

@Guite
Copy link
Member

Guite commented May 29, 2014

Fixed in 3eaa542

@Guite Guite closed this as completed May 29, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants