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

Language switch url gives Redirector error in content #15

Closed
drsdre opened this issue May 12, 2019 · 4 comments
Closed

Language switch url gives Redirector error in content #15

drsdre opened this issue May 12, 2019 · 4 comments

Comments

@drsdre
Copy link
Contributor

drsdre commented May 12, 2019

Since using Laravel 5.8 I'm hitting on an error when I'm switching language using the language()->back($code) function. This error blocks in local (debug) mode, in production the route is followed.

ErrorException: Object of class Illuminate\Routing\Redirector could not be converted to string in file /project/vendor/symfony/http-foundation/Response.php on line 404

My language.php configuration:
'route' => true,
'home' => true,
'url' => false,
'carbon' => true,
'date' => false,
'auto' => true,
'prefix' => 'languages',
'middleware' => 'Akaunting\Language\Middleware\SetLocale',
'mode' => ['code' => 'short', 'name' => 'native'],

@jacquie-engbrecht
Copy link

jacquie-engbrecht commented Jun 4, 2019

I am having the same issue when I click on one of the language links after my session has expired. Also testing locally.

@drsdre
Copy link
Contributor Author

drsdre commented Oct 8, 2019

Found out that this issue occurs if the session expires between the page visit and the language switch. This is where it tries to use $session-previousUrl() which returns null and that cannot be redirected. Added a patch that returns the user to home see #16

@turtlechase
Copy link

Having same problem. @drsdre solution works.

Since it's not merged yet, what I did was created a new controller extending Akaunting\Language\Controllers\Language

Copied methods back (the one we need to edit) and setLocale (because for some reason it's private)

Did @drsdre changes to the method back

Changed controller at app/language.php to the newly created controller

Working for now

@denisdulici
Copy link
Member

Sorry guys for the late reaction, this has been fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants