Closed dudematthew closed 3 years ago
Here is a full stack trace:
Twig\Error\RuntimeError:
Unable to load the "Symfony\Component\Form\FormRenderer" runtime.
at {{path}}:1
at Twig\Environment->getRuntime('Symfony\\Component\\Form\\FormRenderer')
(C:\Users\Mateusz\Documents\Developing\Projekty\RPGMusicLauncher\var\cache\dev\twig\21\216115b0d6ed449916983a6198a29297d128318c4d3e68f45aa6ffcef8316a46.php:932)
at __TwigTemplate_89fa24c52809efe6c5b9bdc53336e5249890deff79daddb4fefe653757103d88->doDisplay(array('last_username' => 'dudematthew', 'error' => null, 'app' => object(AppVariable)), array())
(C:\Users\Mateusz\Documents\Developing\Projekty\RPGMusicLauncher\vendor\twig\twig\src\Template.php:394)
at Twig\Template->displayWithErrorHandling(array('last_username' => 'dudematthew', 'error' => null, 'this' => object(Environment), 'app' => object(AppVariable)), array())
(C:\Users\Mateusz\Documents\Developing\Projekty\RPGMusicLauncher\vendor\twig\twig\src\Template.php:367)
at Twig\Template->display(array('last_username' => 'dudematthew', 'error' => null, 'this' => object(Environment)))
(C:\Users\Mateusz\Documents\Developing\Projekty\RPGMusicLauncher\vendor\twig\twig\src\Template.php:379)
at Twig\Template->render(array('last_username' => 'dudematthew', 'error' => null, 'this' => object(Environment)), array())
(C:\Users\Mateusz\Documents\Developing\Projekty\RPGMusicLauncher\vendor\twig\twig\src\TemplateWrapper.php:40)
at Twig\TemplateWrapper->render(array('last_username' => 'dudematthew', 'error' => null, 'this' => object(Environment)))
(C:\Users\Mateusz\Documents\Developing\Projekty\RPGMusicLauncher\vendor\twig\twig\src\Environment.php:277)
at Twig\Environment->render('security/login.pug', array('last_username' => 'dudematthew', 'error' => null, 'this' => object(Environment)))
(C:\Users\Mateusz\Documents\Developing\Projekty\RPGMusicLauncher\vendor\pug-php\pug-symfony\src\Pug\Twig\Environment.php:190)
at Pug\Twig\Environment->render('security/login.pug', array('last_username' => 'dudematthew', 'error' => null, 'this' => object(Environment)))
(C:\Users\Mateusz\Documents\Developing\Projekty\RPGMusicLauncher\vendor\symfony\framework-bundle\Controller\AbstractController.php:249)
at Symfony\Bundle\FrameworkBundle\Controller\AbstractController->renderView('security/login.pug', array('last_username' => 'dudematthew', 'error' => null))
(C:\Users\Mateusz\Documents\Developing\Projekty\RPGMusicLauncher\vendor\symfony\framework-bundle\Controller\AbstractController.php:257)
at Symfony\Bundle\FrameworkBundle\Controller\AbstractController->render('security/login.pug', array('last_username' => 'dudematthew', 'error' => null))
(C:\Users\Mateusz\Documents\Developing\Projekty\RPGMusicLauncher\src\Controller\SecurityController.php:26)
at App\Controller\SecurityController->login(object(AuthenticationUtils))
(C:\Users\Mateusz\Documents\Developing\Projekty\RPGMusicLauncher\vendor\symfony\http-kernel\HttpKernel.php:157)
at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
(C:\Users\Mateusz\Documents\Developing\Projekty\RPGMusicLauncher\vendor\symfony\http-kernel\HttpKernel.php:79)
at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
(C:\Users\Mateusz\Documents\Developing\Projekty\RPGMusicLauncher\vendor\symfony\http-kernel\Kernel.php:195)
at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
(C:\Users\Mateusz\Documents\Developing\Projekty\RPGMusicLauncher\public\index.php:20)
I will inspect. One small thing first not related to the issue, note that title
should be the name of the block
(block title
in both login.pug and base.pug) and it should be text only inside (if you kept the title
tag in base.pug). Else here, anonymous block would have no effect.
So typical base.pug:
!!!
html
head
meta(charset="UTF-8")
title
block title.
Welcome
block stylesheets
body
block body
block javascripts
And login.pug structure:
extends ../base
block title
Log in!
block body
form(method="post")
if error
.alert.alert-danger=error.messageKey|trans(error.messageData, 'security')
if app.user
.mb-3.
You are logged in as #{ app.user.username }, #[a(href=path('app_logout')) Logout]
h1.h3.mb-3.font-weight-normal Please sign in
label(for="inputEmail") Email
input(type="email" value=last_username name="email" id="inputEmail" class="form-control" required autofocus)
label(for="inputPassword") Password
input(type="password" name="password" id="inputPassword" class="form-control" required)
input(type="hidden" name="_csrf_token" value=csrf_token('authenticate'))
//- Uncomment this section and add a remember_me option below your firewall to activate remember me functionality.
//- See https://symfony.com/doc/current/security/remember_me.html
//- .checkbox.mb-3: label: input(type="checkbox" name="_remember_me") Remember me
button.btn.btn-lg.btn-primary(type="submit") Sign in
I could reproduce, I will see if something changed in the FormRenderer
.
This is likely due to changes in Twig services keys, the fix for FormRenderer
is ready. I will keep this open to check if other components may be impacted.
The version 3.1.1 properly render csrf_token('authenticate')
and form_*
Twig functions.
Perfect support - error doesn't occur anymore. Thank you very much, also thanks for advice :)
Cheers
I had no other runtime problem until now with latest version, so I close this.
Hope you enjoy pug-symfony in your project :)
Hello,
I encountered an issue when:
Tried to use csrf validation in symfony with pug-php
Pug-Symfony version: 3.1
PHP version: 7.2.14
I expected to get:
Normal and working login validation
But I actually get:
Steps to reproduce:
php bin/console make:user
php bin/console make:auth
, withLogin form authenticator
style choosedThis is code from login.pug:
The line, that is causing trouble is
When I try to use (normally working with twig) function
csrf_token('authenticate')
there comes given error.Thanks!