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

Module "Generator" causes fatal error after update to zend-module-manager 2.8.0 #72

Closed
kiwijuicer opened this issue Oct 25, 2017 · 5 comments · Fixed by #73
Closed

Module "Generator" causes fatal error after update to zend-module-manager 2.8.0 #72

kiwijuicer opened this issue Oct 25, 2017 · 5 comments · Fixed by #73
Labels

Comments

@kiwijuicer
Copy link

kiwijuicer commented Oct 25, 2017

After a general composer update my application just broke with following error:

Fatal error: Uncaught Error: The "Generator" class is reserved for internal use and cannot be manually instantiated...

After looking up the breaking change I noticed these new lines in the ModuleResolverListener:

if (class_exists($moduleName)) {
return new $moduleName;
}

It was all working before. Do I now have to rename my module or is there a way to fix this behaviour?

@kiwijuicer
Copy link
Author

Quick work-around is to change the application.config.php entry from 'Generator' to Generator\Module::class

@akrabat
Copy link
Contributor

akrabat commented Oct 25, 2017

Looks like this was caused by #5.

@Xerkus
Copy link
Member

Xerkus commented Oct 25, 2017

One possible fix is to change order to look for $moduleName . '\Module' first.

@weierophinney
Copy link
Member

This is the second time in the past 2 months I've had #5 come up. I don't think anybody ever expected module names could conflict with reserved PHP classes...

We may have to revisit that to check for a namespace separator in the module name before attempting to see if the class exists; if no namespace separator is present, we should likely treat it as a namespace, and not a class.

Thoughts?

@weierophinney
Copy link
Member

One possible fix is to change order to look for $moduleName . '\Module' first.

That's the fallback lookup at this point. I'm not sure what impact it would make if we looked for that first; if somebody with an existing app that demonstrates the behavior would like to give it a try, I'd appreciate it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
4 participants