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

Can't log in after upgrade 2.0.5 to 2.0.9 #3922

Closed
Kaik opened this Issue Aug 10, 2018 · 9 comments

Comments

Projects
None yet
3 participants
@Kaik
Contributor

Kaik commented Aug 10, 2018

Q A
Zikula Version 2.0.9
PHP Version 7.x

Expected behavior

Be able to log in

Actual behavior

Unable to log in error 500

Error

request.CRITICAL: Uncaught PHP Exception Symfony\Component\Routing\Exception\ResourceNotFoundException: "" at
var/www/vhosts/mojeleicester.pl/httpdocs/var/cache/prod/appProdProjectContainerUrlMatcher.php line 5548 {"exception":"[object] (Symfony\\Component\\Routing\\Exception\\ResourceNotFoundException(code: 0):  at /var/www/vhosts/mojeleicester.pl/httpdocs/var/cache/prod/appProdProjectContainerUrlMatcher.php:5548)"} []                                             

Steps to reproduce

I was able to trace it to UsersModule set locale listener. I'm using zikula 2.0.9 with two languages.

When I disable https://github.com/zikula/core/blob/master/src/system/UsersModule/Listener/UserEventListener.php#L74-L77
I'm able to log in...

@craigh

This comment has been minimized.

Member

craigh commented Aug 10, 2018

try clearing the cache?

@Kaik

This comment has been minimized.

Contributor

Kaik commented Aug 10, 2018

Yes, that is a basic thing to do... My wild guess is that there might be a missing route translation??. It was late and I needed it to work so I commented out bit that generated error no further investigation..

@Guite

This comment has been minimized.

Member

Guite commented Aug 10, 2018

a missing route translation

Likely

@Kaik

This comment has been minimized.

Contributor

Kaik commented Aug 10, 2018

screenshot from 2018-08-10 22-26-49
Hmm this might take some time to trace which one is empty... I will but for now I'm just disabling it.

@craigh

This comment has been minimized.

Member

craigh commented Aug 10, 2018

does it work in english?

@Guite

This comment has been minimized.

Member

Guite commented Aug 10, 2018

Try replacing https://github.com/zikula/core/blob/2.0/src/system/UsersModule/Listener/UserEventListener.php#L68-L77 by:

            $url = $event->getArgument('returnUrl');
            if ('' != $url) {
                $request = $this->requestStack->getCurrentRequest();
                $httpRoot = $request->getSchemeAndHttpHost() . $request->getBaseUrl();
                if (0 === strpos($url, $httpRoot)) {
                    $url = str_replace($httpRoot, '', $url);
                }
                $pathInfo = $this->router->match($url);
                if ($pathInfo['_route']) {
                    $event->setArgument('returnUrl', $this->router->generate($pathInfo['_route'], ['_locale' => $locale]));
                }
            }
@Kaik

This comment has been minimized.

Contributor

Kaik commented Aug 11, 2018

@craigh no same error in English...
@Guite works! Thx

@Guite Guite added this to the 2.1.0 milestone Aug 12, 2018

@Guite Guite closed this in ff83186 Aug 12, 2018

@craigh

This comment has been minimized.

Member

craigh commented Aug 12, 2018

@Guite wrt
ff83186

obviously, I'm not really paying attention. But - isn't an exception a good idea when there is no translation? By avoiding the exception, haven't you made a route inaccessible and then hiding the fact that it is inaccessible? Isn't the proper solution to throw an exception and force the translator to provide a proper translation? Or at the very least, use the default route (e.g. English)? I'm not sure simply hiding the problem is the best solution.

@Guite

This comment has been minimized.

Member

Guite commented Aug 13, 2018

Two aspects:

  1. I do not assume that a missing translation is the only possible cause for a missing return url.
  2. A missing route translation will cause an exception anyway, but should not block the login.

@Guite Guite modified the milestones: 2.1.0, 3.0.0 Nov 2, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment