Unexpected 'protected' in RouteNormalizerRequestSubscriber.php on line 71

Created on 22 January 2025, 3 months ago

Problem/Motivation

After upgrading from Redirect 1.10 to 1.11, I got "The website encountered an unexpected error. Please try again later." error. In the error log I see this:

ParseError: syntax error, unexpected 'protected' (T_PROTECTED), expecting variable (T_VARIABLE) in /app/web/modules/contrib/redirect/src/EventSubscriber/RouteNormalizerRequestSubscriber.php on line 71 #0 /app/vendor/composer/ClassLoader.php(427): Composer\Autoload\{closure}('/app/web/module...')
#1 [internal function]: Composer\Autoload\ClassLoader->loadClass('Drupal\\redirect...')
#2 [internal function]: spl_autoload_call('Drupal\\redirect...')
#3 /app/web/core/lib/Drupal/Core/DependencyInjection/Compiler/RegisterEventSubscribersPass.php(30): ReflectionClass->__construct('Drupal\\redirect...')
#4 /app/vendor/symfony/dependency-injection/Compiler/Compiler.php(94): Drupal\Core\DependencyInjection\Compiler\RegisterEventSubscribersPass->process(Object(Drupal\Core\DependencyInjection\ContainerBuilder))
#5 /app/vendor/symfony/dependency-injection/ContainerBuilder.php(762): Symfony\Component\DependencyInjection\Compiler\Compiler->compile(Object(Drupal\Core\DependencyInjection\ContainerBuilder))
#6 /app/web/core/lib/Drupal/Core/DrupalKernel.php(1351): Symfony\Component\DependencyInjection\ContainerBuilder->compile()
#7 /app/web/core/lib/Drupal/Core/DrupalKernel.php(948): Drupal\Core\DrupalKernel->compileContainer()
#8 /app/web/core/lib/Drupal/Core/Update/UpdateKernel.php(42): Drupal\Core\DrupalKernel->initializeContainer()
#9 /app/vendor/drush/drush/src/Drupal/DrupalKernelTrait.php(69): Drupal\Core\Update\UpdateKernel->initializeContainer()
#10 /app/web/core/lib/Drupal/Core/DrupalKernel.php(487): Drush\Drupal\UpdateKernel->initializeContainer()
#11 /app/vendor/drush/drush/src/Boot/DrupalBoot8.php(241): Drupal\Core\DrupalKernel->boot()
#12 /app/vendor/drush/drush/src/Boot/BootstrapManager.php(293): Drush\Boot\DrupalBoot8->bootstrapDrupalFull(Object(Drush\Boot\BootstrapManager), Object(Consolidation\AnnotatedCommand\AnnotationData))
#13 /app/vendor/drush/drush/src/Boot/BootstrapManager.php(447): Drush\Boot\BootstrapManager->doBootstrap(5, 5, Object(Consolidation\AnnotatedCommand\AnnotationData))
#14 /app/vendor/drush/drush/src/Boot/BootstrapManager.php(396): Drush\Boot\BootstrapManager->bootstrapToPhaseIndex(5, Object(Consolidation\AnnotatedCommand\AnnotationData))
#15 /app/vendor/drush/drush/src/Boot/BootstrapHook.php(28): Drush\Boot\BootstrapManager->bootstrapToPhase('full', Object(Consolidation\AnnotatedCommand\AnnotationData))
#16 /app/vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php(44): Drush\Boot\BootstrapHook->initialize(Object(Drush\Symfony\DrushArgvInput), Object(Consolidation\AnnotatedCommand\AnnotationData))
#17 /app/vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php(36): Consolidation\AnnotatedCommand\Hooks\Dispatchers\InitializeHookDispatcher->doInitializeHook(Object(Drush\Boot\BootstrapHook), Object(Drush\Symfony\DrushArgvInput), Object(Consolidation\AnnotatedCommand\AnnotationData))
#18 /app/vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php(29): Consolidation\AnnotatedCommand\Hooks\Dispatchers\InitializeHookDispatcher->callInitializeHook(Object(Drush\Boot\BootstrapHook), Object(Drush\Symfony\DrushArgvInput), Object(Consolidation\AnnotatedCommand\AnnotationData))
#19 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(145): Consolidation\AnnotatedCommand\Hooks\Dispatchers\InitializeHookDispatcher->initialize(Object(Drush\Symfony\DrushArgvInput), Object(Consolidation\AnnotatedCommand\AnnotationData))
#20 /app/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(376): Consolidation\AnnotatedCommand\CommandProcessor->initializeHook(Object(Drush\Symfony\DrushArgvInput), Array, Object(Consolidation\AnnotatedCommand\AnnotationData))
#21 /app/vendor/symfony/console/Command/Command.php(221): Consolidation\AnnotatedCommand\AnnotatedCommand->initialize(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 /app/vendor/symfony/console/Application.php(1039): Symfony\Component\Console\Command\Command->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#23 /app/vendor/symfony/console/Application.php(275): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#24 /app/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#25 /app/vendor/drush/drush/src/Runtime/Runtime.php(118): Symfony\Component\Console\Application->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#26 /app/vendor/drush/drush/src/Runtime/Runtime.php(48): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
#27 /app/vendor/drush/drush/drush.php(72): Drush\Runtime\Runtime->run(Array)
#28 /app/vendor/drush/drush/drush(3): require('/app/vendor/dru...')
#29 /app/vendor/bin/drush(115): include('/app/vendor/dru...')
#30 {main}
ParseError: syntax error, unexpected 'protected' (T_PROTECTED), expecting variable (T_VARIABLE) in Composer\Autoload\{closure}() (line 71 of /app/web/modules/contrib/redirect/src/EventSubscriber/RouteNormalizerRequestSubscriber.php).
 [warning] Drush command terminated abnormally.

Steps to reproduce

Upgrade Redirect from 1.10 to 1.11 if you use Drupal 9.5.11 and php 7.4.33 (I know, outdated, but the module still indicates that I can use it: `core_version_requirement: ^9.2 || ^10 || ^11`).

Proposed resolution

I don't exactly know, but I see that there were changes regarding the above error in the last version: https://git.drupalcode.org/project/redirect/-/compare/8.x-1.10...8.x-1.1...

🐛 Bug report
Status

Active

Version

1.11

Component

Code

Created by

🇭🇺Hungary Pene

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

Comments & Activities

Production build 0.71.5 2024