Skip to content

Unable to load the "Symfony\Component\Form\FormRenderer" runtime issue #59

@dudematthew

Description

@dudematthew

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:

Unable to load the "Symfony\Component\Form\FormRenderer" runtime.

Steps to reproduce:

  • install newest symfony
  • install newest pug-php
  • some addons like Route
  • make user entity with php bin/console make:user
  • make auth controller with php bin/console make:auth, with Login form authenticator style choosed
  • convert manually login.html.twig to login.pug

This is code from login.pug:

extends ../base.pug

block 
	title Login in!

block body
	form(method="post")
		if error
			if error.messageKey !== undefined
				div.alert.alert-danger #{error.messageKey}
			else
				div.alert.alert-danger #{trans(error.messageData, 'security')}

		if app.user
			div.mb-3 You are logged in as #{ app.user.username },
				a(href=path('app_logout')) Log Out

		h1.h3.mb-3.font-weight-normal Please sign in
		label(for="inputUsername") Username
		input#inputUsername.form-control(type="text", value=last_username, name="username", required, autofocus)
		label(for="inputPassword") Password
		input#inputPassword.form-control(type="password", name="password", required)

		div.alert.alert-danger 

		.checkbox.mb-3
		    label
		        input(type="checkbox", name="_remember_me")
		        |  Remember me


		button.btn.btn-lg.btn-primary(type="submit", value=csrf_token('authenticate')) Sign in

		//- See https://symfony.com/doc/current/security/remember_me.html

The line, that is causing trouble is

button.btn.btn-lg.btn-primary(type="submit", value=csrf_token('authenticate')) Sign in

When I try to use (normally working with twig) function csrf_token('authenticate') there comes given error.

Thanks!

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions