Detect and fail if Twig debugging is enabled

Created on 17 February 2023, almost 2 years ago
Updated 29 March 2023, almost 2 years ago

Problem/Motivation

I am trying to update my Drupal 7 module to Drupal 8+, but when running drush dmu-upgrade my_module, I get the following error:

[error] Error at line 3:1: unexpected < operator!

The error is comming from the required "pharborist" library. I am using Drupal 9.5 with php 7.4.
Here is the error with the full backtrace:

drush dmu-upgrade my_module
Indexing...
done.
 [error]  Error at line 3:1: unexpected < operator! 
 [notice] #0 /var/www/html/vendor/jcnventura/pharborist/src/ExpressionParser.php(96): Pharborist\ExpressionParser->P()
#1 /var/www/html/vendor/jcnventura/pharborist/src/ExpressionParser.php(83): Pharborist\ExpressionParser->E()
#2 /var/www/html/vendor/jcnventura/pharborist/src/Parser.php(1246): Pharborist\ExpressionParser->parse(Array, NULL)
#3 /var/www/html/vendor/jcnventura/pharborist/src/Parser.php(533): Pharborist\Parser->expr()
#4 /var/www/html/vendor/jcnventura/pharborist/src/Parser.php(492): Pharborist\Parser->exprStatement()
#5 /var/www/html/vendor/jcnventura/pharborist/src/Parser.php(369): Pharborist\Parser->statement()
#6 /var/www/html/vendor/jcnventura/pharborist/src/Parser.php(329): Pharborist\Parser->topStatement()
#7 /var/www/html/vendor/jcnventura/pharborist/src/Parser.php(210): Pharborist\Parser->topStatementList(Object(Pharborist\RootNode))
#8 /var/www/html/vendor/jcnventura/pharborist/src/Parser.php(248): Pharborist\Parser->buildTree(Object(Pharborist\TokenIterator))
#9 /var/www/html/vendor/jcnventura/pharborist/src/Parser.php(258): Pharborist\Parser::parseSource('<?php \n\n<!-- TH...')
#10 /var/www/html/web/modules/contrib/drupalmoduleupgrader/src/ConverterBase.php(199): Pharborist\Parser::parseSnippet(Object(Drupal\Core\Render\Markup))
#11 /var/www/html/web/modules/contrib/drupalmoduleupgrader/src/Plugin/DMU/Converter/HookFieldWidgetInfo.php(47): Drupal\drupalmoduleupgrader\ConverterBase->parse(Object(Drupal\Core\Render\Markup))
#12 /var/www/html/web/modules/contrib/drupalmoduleupgrader/src/Commands/DrupalmoduleupgraderCommands.php(188): Drupal\drupalmoduleupgrader\Plugin\DMU\Converter\HookFieldWidgetInfo->convert(Object(Drupal\drupalmoduleupgrader\Target))
#13 [internal function]: Drupal\drupalmoduleupgrader\Commands\DrupalmoduleupgraderCommands->upgrade('zmp_marketdatas...', Array)
#14 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array(Array, Array)
#15 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
#16 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#17 /var/www/html/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(390): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#18 /var/www/html/vendor/symfony/console/Command/Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 /var/www/html/vendor/symfony/console/Application.php(1039): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#20 /var/www/html/vendor/symfony/console/Application.php(275): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#21 /var/www/html/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(124): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#23 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(51): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
#24 /var/www/html/vendor/drush/drush/drush.php(77): Drush\Runtime\Runtime->run(Array)
#25 /var/www/html/vendor/drush/drush/drush(3): require('/var/www/html/v...')
#26 /var/www/html/vendor/bin/drush(115): include('/var/www/html/v...')
#27 {main}

The .info.yml gets created, but nothing else.

Steps to reproduce

  • Install the drupalmoduleupgrader module
  • Upgrade a module residing in "web/modules/custom" using drush dmu-upgrade my_module in the projects root directory
  • Error

Proposed resolution

Fix the issue.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

🇩🇪Germany Grevil

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024