简体   繁体   中英

CRITICAL - Uncaught PHP Exception Twig_Error_Syntax: "Unexpected "}" in "@WebProfiler/Profiler/base.html.twig

I am trying to build a new feature on a symfony project but when running the app I get this error in a pop window in my browser

在此处输入图片说明

When I click " OK " to open the profiler I get the bellow:

Unexpected "}" in @WebProfiler/Profiler/base.html.twig at line 21 500 Internal Server Error - Twig_Error_Syntax

Stack Trace

  1. in C:\\esnet-portal\\vendor\\twig\\twig\\lib\\Twig\\Lexer.php at line 259

     // closing bracket elseif (false !== strpos(')]}', $this->code[$this->cursor])) { if (empty($this->brackets)) { throw new Twig_Error_Syntax(sprintf('Unexpected "%s"', $this->code[$this->cursor]), $this->lineno, $this->filename); } list($expect, $lineno) = array_pop($this->brackets);

The logs have this CRITICAL ERROR:

CRITICAL - Uncaught PHP Exception Twig_Error_Syntax: "Unexpected "}" in "@WebProfiler/Profiler/base.html.twig" at line 21" at C:\esnet-portal\vendor\twig\twig\lib\Twig\Lexer.php line 259

I am using: Symfony version v4.13.3 ** and **PHP 7.2.15

I think the only thing I did before getting this error was upgrading composer!

When I run this command: php app/console doctrine:schema:validate I get the below:

PHP Warning: require_once(C:\\esnet-portal\\app/bootstrap.php.cache): failed to open stream: No such file or directory in C:\\esnet-portal\\app\\console on line 10

Warning: require_once(C:\esnet-portal\app/bootstrap.php.cache): failed to open stream: No such file or directory in C:\esnet-portal\app\console on line 10
PHP Fatal error:  require_once(): Failed opening required 'C:\esnet-portal\app/bootstrap.php.cache' (include_path='\xampp\php\PEAR') in C:\esnet-portal\app\console on line 10

Fatal error: require_once(): Failed opening required 'C:\esnet-portal\app/bootstrap.php.cache' (include_path='\xampp\php\PEAR') in C:\esnet-portal\app\console on line 10

The answer to this was to create bootstrap.php via the command below:

php vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php

Also, had to re-clone the repo from git and start with a fresh directory structure, after that I ran composer install from within the root directory of my app. No need to update composer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM