I just upgraded my local installation to the new Laravel 6 base. It seems like the locale prefixes are not correctly detected.
When visiting /en/category/test, this exception is thrown:
An exception has been thrown during the rendering of a template ("Missing required parameters for [Route: ] [URI: en/{slug}].") in "/dir/themes/my-theme/layouts/default.htm" at line 18.
/dir/vendor/twig/twig/src/Template.php line 421
Navigation to all pages fails. If I remove the locale prefix, the page loads correctly (/category/test).
Full stack trace:
Next Twig\Error\RuntimeError: An exception has been thrown during the rendering of a template ("Missing required parameters for [Route: ] [URI: en/{slug}].") in "/dir/themes/my-theme/layouts/default.htm" at line 18. in /dir/vendor/twig/twig/src/Template.php:421
Stack trace:
#0 /dir/vendor/twig/twig/src/Template.php(380): Twig\Template->displayWithErrorHandling(Array, Array)
#1 /dir/vendor/twig/twig/src/Template.php(392): Twig\Template->display(Array)
#2 /dir/modules/cms/classes/Controller.php(433): Twig\Template->render(Array)
#3 /dir/modules/cms/classes/Controller.php(223): Cms\Classes\Controller->runPage(Object(Cms\Classes\Page))
#4 /dir/modules/cms/classes/CmsController.php(50): Cms\Classes\Controller->run('category/test')
#5 [internal function]: Cms\Classes\CmsController->run('category/test')
#6 /dir/plugins/bedard/debugbar/vendor/illuminate/routing/Controller.php(54): call_user_func_array(Array, Array)
#7 /dir/plugins/bedard/debugbar/vendor/illuminate/routing/ControllerDispatcher.php(45): Illuminate\Routing\Controller->callAction('run', Array)
#8 /dir/plugins/bedard/debugbar/vendor/illuminate/routing/Route.php(219): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Cms\Classes\CmsController), 'run')
#9 /dir/plugins/bedard/debugbar/vendor/illuminate/routing/Route.php(176): Illuminate\Routing\Route->runController()
#10 /dir/vendor/laravel/framework/src/Illuminate/Routing/Router.php(681): Illuminate\Routing\Route->run()
#11 /dir/plugins/bedard/debugbar/vendor/illuminate/pipeline/Pipeline.php(130): Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#12 /dir/plugins/rainlab/translate/classes/LocaleMiddleware.php(29): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#13 /dir/plugins/bedard/debugbar/vendor/illuminate/pipeline/Pipeline.php(171): RainLab\Translate\Classes\LocaleMiddleware->handle(Object(Illuminate\Http\Request), Object(Closure))
#14 /dir/plugins/bedard/debugbar/vendor/illuminate/routing/Middleware/SubstituteBindings.php(41): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#15 /dir/plugins/bedard/debugbar/vendor/illuminate/pipeline/Pipeline.php(171): Illuminate\Routing\Middleware\SubstituteBindings->handle(Object(Illuminate\Http\Request), Object(Closure))
#16 /dir/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#17 /dir/plugins/bedard/debugbar/vendor/illuminate/pipeline/Pipeline.php(171): Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#18 /dir/plugins/bedard/debugbar/vendor/illuminate/session/Middleware/StartSession.php(56): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#19 /dir/plugins/bedard/debugbar/vendor/illuminate/pipeline/Pipeline.php(171): Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#20 /dir/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#21 /dir/plugins/bedard/debugbar/vendor/illuminate/pipeline/Pipeline.php(171): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))
#22 /dir/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(66): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#23 /dir/plugins/bedard/debugbar/vendor/illuminate/pipeline/Pipeline.php(171): Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))
#24 /dir/plugins/bedard/debugbar/vendor/illuminate/pipeline/Pipeline.php(105): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#25 /dir/vendor/laravel/framework/src/Illuminate/Routing/Router.php(683): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#26 /dir/vendor/laravel/framework/src/Illuminate/Routing/Router.php(658): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#27 /dir/vendor/laravel/framework/src/Illuminate/Routing/Router.php(624): Illuminate\Routing\Router->runRoute(Object(Illuminate\Http\Request), Object(Illuminate\Routing\Route))
#28 /dir/vendor/october/rain/src/Router/CoreRouter.php(20): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#29 /dir/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(170): October\Rain\Router\CoreRouter->dispatch(Object(Illuminate\Http\Request))
#30 /dir/plugins/bedard/debugbar/vendor/illuminate/pipeline/Pipeline.php(130): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))
#31 /dir/plugins/bedard/debugbar/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php(65): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#32 /dir/plugins/bedard/debugbar/vendor/illuminate/pipeline/Pipeline.php(171): Barryvdh\Debugbar\Middleware\InjectDebugbar->handle(Object(Illuminate\Http\Request), Object(Closure))
#33 /dir/plugins/offline/speedy/classes/middleware/CDNMiddleware.php(40): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#34 /dir/plugins/bedard/debugbar/vendor/illuminate/pipeline/Pipeline.php(171): OFFLINE\Speedy\Classes\Middleware\CDNMiddleware->handle(Object(Illuminate\Http\Request), Object(Closure))
#35 /dir/plugins/offline/speedy/classes/middleware/Http2Middleware.php(38): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#36 /dir/plugins/bedard/debugbar/vendor/illuminate/pipeline/Pipeline.php(171): OFFLINE\Speedy\Classes\Middleware\Http2Middleware->handle(Object(Illuminate\Http\Request), Object(Closure))
#37 /dir/plugins/offline/responsiveimages/classes/ResponsiveImagesMiddleware.php(30): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#38 /dir/plugins/bedard/debugbar/vendor/illuminate/pipeline/Pipeline.php(171): OFFLINE\ResponsiveImages\Classes\ResponsiveImagesMiddleware->handle(Object(Illuminate\Http\Request), Object(Closure))
#39 /dir/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(63): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#40 /dir/vendor/october/rain/src/Foundation/Http/Middleware/CheckForMaintenanceMode.php(24): Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
#41 /dir/plugins/bedard/debugbar/vendor/illuminate/pipeline/Pipeline.php(171): October\Rain\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
#42 /dir/plugins/vdlp/redirect/classes/RedirectMiddleware.php(64): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#43 /dir/plugins/bedard/debugbar/vendor/illuminate/pipeline/Pipeline.php(171): Vdlp\Redirect\Classes\RedirectMiddleware->handle(Object(Illuminate\Http\Request), Object(Closure))
#44 /dir/plugins/bedard/debugbar/vendor/illuminate/pipeline/Pipeline.php(105): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#45 /dir/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(145): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#46 /dir/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(110): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#47 /dir/index.php(43): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#48 {main}
@bennothommo we can push it out on a separate wip/laravel-6 branch on that plugin and then people can test it by pulling the plugin in with Composer.
@LukeTowers good idea.
@tobias-kuendig Would you be able to pull in the changes here and give that a test to see if it resolves the issue for you:
https://github.com/rainlab/translate-plugin/commit/3e31cee945f3cde55cab0ebd0fa278555207302e
:ok_hand: problem solved!
@tobias-kuendig Great stuff!
Fixed as of https://github.com/rainlab/translate-plugin/commit/3e31cee945f3cde55cab0ebd0fa278555207302e.
I am still getting this error if the "Route prefixing" setting is enabled. I am using Translate 1.6.7 with https://github.com/rainlab/translate-plugin/commit/3e31cee945f3cde55cab0ebd0fa278555207302e applied. I only get the error when going to a URL that uses the default language, e.g. if I go to /en/photos I get the error, but if I go to /es/fotos I don't get the error and the page loads correctly.
Thanks @multiwebinc - I will check it out.
Hi guys, I'm facing the same issue, but I've found out that the problem was generated by Translate Extended plugin. Without that module the fix in 3e31cee works fine to me. I'm commenting just in case someone else has the same problem.
@OutlawPlz I've submitted a PR to the Translate Extended plugin to fix this up: https://github.com/Excodus/oc-translate-extended/pull/20
Hi! I just installed a new october and Translate Plugin, and I got this error. Maybe you need to push this fix to production?
@mariavilaro we cannot push this until the L6 branch becomes the new stable release.
Thanks.
Uhm... I just installed october using the command line
composer create-project october/october myProject
And it installed the version 1.1.0 of october that uses L6
Do you know how should I do to install the L5.5 version? (sorry for the off topic)
Edit: ok I found it: composer create-project october/october myProject 1.0.469
I thought composer installed by default the last stable version.
@mariavilaro Use the composer.json file from the 1.0 branch of github.
ref. https://github.com/octobercms/october/blob/1.0/composer.json
@mariavilaro 1.1 is the latest stable version, the marketplace is just a bit behind. Use composer to install the translate plugin
@bennothommo would the change break L5.5 users of the plugin?
@LukeTowers Most likely, or that would have been added to the main repo...
You know what they say about assuming 馃槈
I can check this for you if you want, we'll know for sure! ;)
@LukeTowers Initial tests show it appears to be working fine...
@bennothommo can you shed some light on why that change is needed in the first place?
@mjauvin I know it's required in L6, I think @bennothommo didn't merge it because he didn't test it in L5.5. If it's working fine for L6 and L5.5 let's just merge it and push out the update.
@LukeTowers Sure, but I'd like to understand the reason this change is required in L6, that may help understand if that could cause an issue I am not seeing with my initial tests.
@LukeTowers @mjauvin I think it should work for L5.5, but yes, I didn't test it for that. I can't recall the exact change that Laravel made, but it seemed that slug parameter in our catch-all routes became required (or at least, the way it was defined made it required) - my change was simply to make it optional as it was before.
Ok, so if that really make it optional with L6 and L5.5 was optional by default, that should be fine.
Thoughts @LukeTowers
You can apply to master if you're fine with it, I did test it a bit and it worked fine.
@mjauvin if you've tested it and it works fine go for it. Just let me know when to update the marketplace pending version.
@LukeTowers 1.7.3 is out, but I wouldn't mark it stable yet, maybe wait a couple weeks?
@mjauvin just ping me when it's good to go