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

PHP Fatal error: LocalLockFactory #585

Closed
SirFlip opened this issue Dec 22, 2019 · 8 comments
Closed

PHP Fatal error: LocalLockFactory #585

SirFlip opened this issue Dec 22, 2019 · 8 comments
Assignees
Labels
Milestone

Comments

@SirFlip
Copy link
Contributor

SirFlip commented Dec 22, 2019

How Shlink is set-up

  • Shlink Version: 1.20.2
  • PHP Version: 7.4 (7.2 7.3)
  • How do you serve Shlink: Self-hosted Apache
  • Database engine used: MariaDB (10.4.11)

Summary

when using the cli I get a PHP fatal error. Discovered, because the "visit:locate" didn't work. The web api and the link resolving works fine as far as I know.

Current behavior

bin/cli visit:locate
PHP Fatal error: Uncaught Error: Class 'Shlinkio\Shlink\LocalLockFactory' not found in /var/www/shlink/vendor/zendframework/zend-servicemanager/src/AbstractFactory/ConfigAbstractFactory.php:70
Stack trace:
#0 /var/www/shlink/vendor/zendframework/zend-servicemanager/src/ServiceManager.php(764): Zend\ServiceManager\AbstractFactory\ConfigAbstractFactory->__invoke()
#1 /var/www/shlink/vendor/zendframework/zend-servicemanager/src/ServiceManager.php(200): Zend\ServiceManager\ServiceManager->doCreate()
#2 [internal function]: Zend\ServiceManager\ServiceManager->get()
#3 /var/www/shlink/vendor/zendframework/zend-servicemanager/src/AbstractFactory/ConfigAbstractFactory.php(68): array_map()
#4 /var/www/shlink/vendor/zendframework/zend-servicemanager/src/ServiceManager.php(764): Zend\ServiceManager\AbstractFactory\ConfigAbstractFactory->__invoke()
#5 /var/www/shlink/vendor/zendframework/zend-servicemanager/src/ServiceManager.php(200): Zend\ServiceManager\ServiceManager->doCreate()
#6 [internal function]: Zend\ServiceManager\ServiceManag in /var/www/shlink/vendor/zendframework/zend-servicemanager/src/AbstractFactory/ConfigAbstractFactory.php on line 70

How to reproduce

I don't know on other machines. For me its presistent on every command I tried.

@SirFlip SirFlip added the bug label Dec 22, 2019
@acelaya
Copy link
Member

acelaya commented Dec 22, 2019

Thanks for reporting!

I will investigate and try to get a fix as soon as possible.

@acelaya
Copy link
Member

acelaya commented Dec 22, 2019

@SirFlip I'm having some problems reproducing this bug.

I have tried a few combinations, but I see you reported the PHP version as PHP Version: 7.4 (7.2 7.3).

What's exactly the version you used? Or did you try the three of them?

@SirFlip
Copy link
Contributor Author

SirFlip commented Dec 22, 2019

The main one is 7.4 but because of other stuff on the server I have the other ones as well and tried them out.

@acelaya
Copy link
Member

acelaya commented Dec 22, 2019

I was asking because shlink is not yet compatible with PHP 7.4, and that's probably the reason it fails with that version.

However, it should work with the other two versions.

I will try to reproduce it with 7.4, just to make sure.

This is the reason shlink does not support PHP 7.4 yet, in case you are curious #576

Shlink v2 will only support PHP 7.4, and it will be released after v1.21, which is mostly done, so v2 should be ready on the first quarter 2020

@acelaya
Copy link
Member

acelaya commented Dec 22, 2019

Ok, I just reproduced it with all three versions. It seems the problem is on the dist file somehow, since it works with the official docker image 🤔

I will try to get it fixed.

@acelaya acelaya added this to the 1.20.3 milestone Dec 22, 2019
@acelaya acelaya self-assigned this Dec 22, 2019
@acelaya
Copy link
Member

acelaya commented Dec 23, 2019

@SirFlip I found the root cause for this issue.

While a fix is provided, you can workaround it by doing this:

Open the config/container.php file and add this line:

 }
 
 // Build container
+class_alias(\Symfony\Component\Lock\Factory::class, 'Shlinkio\Shlink\LocalLockFactory');
 $config = require __DIR__ . '/config.php';
 $container = new ServiceManager($config['dependencies']);
 $container->setService('config', $config);

After that, the error should be gone.

@SirFlip
Copy link
Contributor Author

SirFlip commented Dec 23, 2019

Yes that works thank you very much for all your work.

Merry Christmas and a happy new year

@acelaya acelaya mentioned this issue Dec 23, 2019
@acelaya
Copy link
Member

acelaya commented Dec 23, 2019

I have just released Shlink 1.20.3, which includes this fix https://github.com/shlinkio/shlink/releases/tag/v1.20.3

@acelaya acelaya closed this as completed Dec 23, 2019
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

2 participants