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

Module doesn't work after last ZF2 update. #29

Open
syberon opened this issue Mar 11, 2016 · 2 comments
Open

Module doesn't work after last ZF2 update. #29

syberon opened this issue Mar 11, 2016 · 2 comments
Assignees
Labels

Comments

@syberon
Copy link

syberon commented Mar 11, 2016

Module doesn't work after last ZF2 update (2.5.3) with ServiceLocatorAwareInterface are deprecated.

Fatal error appears:
Fatal error: Uncaught Error: Call to a member function get() on null in C:\SERVER\projects\mt\vendor\hrevert\ht-img-module\src\Factory\Imagine\Loader\FileSystemLoaderFactory.php:12 Stack trace: #0 [internal function]: HtImgModule\Factory\Imagine\Loader\FileSystemLoaderFactory->createService(Object(HtImgModule\Imagine\Loader\LoaderPluginManager), 'filesystem', 'FileSystem') #1 C:\SERVER\projects\mt\vendor\zendframework\zend-servicemanager\src\ServiceManager.php(936): call_user_func(Array, Object(HtImgModule\Imagine\Loader\LoaderPluginManager), 'filesystem', 'FileSystem') #2 C:\SERVER\projects\mt\vendor\zendframework\zend-servicemanager\src\AbstractPluginManager.php(330): Zend\ServiceManager\ServiceManager->createServiceViaCallback(Array, 'filesystem', 'FileSystem') #3 C:\SERVER\projects\mt\vendor\zendframework\zend-servicemanager\src\AbstractPluginManager.php(287): Zend\ServiceManager\AbstractPluginManager->createServiceViaCallback(Array, 'filesystem', 'FileSystem') #4 C:\SERVER\projects\mt\vendor\zendframework\zend-servic in C:\SERVER\projects\mt\vendor\hrevert\ht-img-module\src\Factory\Imagine\Loader\FileSystemLoaderFactory.php on line 12

It works good with previous version of ZF2 (2.5.2)

@syberon
Copy link
Author

syberon commented Mar 11, 2016

The problem appears because in new version of ZF2 there is no ServiceLocator auto injected in LoaderPluginManagerFactory to new created LoaderPluginManager object . The workaround is to manually add ServiceLocator to object by changing the code of factory to:

    $loaderPluginManager = new LoaderPluginManager(new Config($serviceLocator->get('Config')['htimg']['loaders']));
    $loaderPluginManager->setServiceLocator($serviceLocator);
    return $loaderPluginManager;

@ojhaujjwal ojhaujjwal self-assigned this Mar 11, 2016
@ojhaujjwal ojhaujjwal added the bug label Mar 11, 2016
@Danielss89
Copy link

I made a pull request for this:
#33

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

3 participants