Route serialization incompatibilities between PHP 7.4 and 7.3 (9.x only)

Created on 4 June 2020, about 4 years ago
Updated 5 October 2022, over 1 year ago

I sought to set up a new site using the following commands (plus setting up a DB and settings.php, of course):

composer create-project drupal/recommended-project project
cd project
composer require hirak/prestissimo drush/drush

The resulting installation works fine if I use the browser based install but if I try to do drush si -y, it runs to completion but attempting to visit the site gives the following error:

The website encountered an unexpected error. Please try again later.
TypeError: Argument 2 passed to Symfony\Component\Routing\RouteCollection::add() must be an instance of Symfony\Component\Routing\Route, bool given, called in /home/nigel/public_html/sites/pdftron-test/web/core/lib/Drupal/Core/Routing/RouteProvider.php on line 382 in Symfony\Component\Routing\RouteCollection->add() (line 74 of /home/nigel/public_html/sites/pdftron-test/vendor/symfony/routing/RouteCollection.php).
Symfony\Component\Routing\RouteCollection->add('user.reset.login', ) (Line: 382)
Drupal\Core\Routing\RouteProvider->getRoutesByPath('/user/reset/1/1591246278/kePofF69JBJQtdHnGINRNWbr46V9akA4vIAtpmHFb0E/login') (Line: 182)
Drupal\Core\Routing\RouteProvider->getRouteCollectionForRequest(Object) (Line: 237)
Drupal\Core\Routing\Router->getInitialRouteCollection(Object) (Line: 121)
Drupal\Core\Routing\Router->matchRequest(Object) (Line: 92)
Drupal\Core\Routing\AccessAwareRouter->matchRequest(Object) (Line: 112)
Symfony\Component\HttpKernel\EventListener\RouterListener->onKernelRequest(Object, 'kernel.request', Object) (Line: 78)
Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy->dispatch(Object, 'kernel.request') (Line: 134)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 80)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 705)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

So far I've found that the autoloader's namespace cache seems to be almost empty, resulting in $check returning '' at line 104 of vendor/laminas/laminas-zendframework-bridge/src/Autoloader.php. Its contents at that point are:

Array
(
    [Laminas\Xml\] => ZendXml\
    [Laminas\OAuth\] => ZendOAuth\
    [Laminas\Diagnostics\] => ZendDiagnostics\
    [Laminas\DeveloperTools\] => ZendDeveloperTools\
    [Laminas\ReCaptcha\] => ZendService\ReCaptcha\
    [Laminas\Twitter\] => ZendService\Twitter\
    [Laminas\] => Zend\
    [Mezzio\ProblemDetails\] => Zend\ProblemDetails\
    [Mezzio\] => Zend\Expressive\
    [Laminas\ComposerAutoloading\] => ZF\ComposerAutoloading\
    [Laminas\DevelopmentMode\] => ZF\DevelopmentMode\
    [Laminas\ApiTools\Admin\] => ZF\Apigility\Admin\
    [Laminas\ApiTools\Doctrine\] => ZF\Apigility\Doctrine\
    [Laminas\ApiTools\Documentation\] => ZF\Apigility\Documentation\
    [Laminas\ApiTools\Example\] => ZF\Apigility\Example\
    [Laminas\ApiTools\Provider\] => ZF\Apigility\Provider\
    [Laminas\ApiTools\Welcome\] => ZF\Apiglity\Welcome\
    [Laminas\ApiTools\] => ZF\
)

[nigel@nigel]$ drush --version
Drush Commandline Tool 10.2.2

πŸ› Bug report
Status

Fixed

Version

9.1

Component
InstallΒ  β†’

Last updated 1 day ago

No maintainer
Created by

πŸ‡¦πŸ‡ΊAustralia Nigel Cunningham Geelong

Live updates comments and jobs are added and updated live.
  • PHP 7.4

    The issue particularly affects sites running on PHP version 7.4.0 or later.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¨πŸ‡΄Colombia aldibier Manizales

    Hi people, I had this issue and none previous patch solve my problem, after trying many options, I solved this issue following this Steps.

    1. truncate table router in database:

    TRUNCATE TABLE router;

    2. truncate all cache tables, prevously i've identified all cache tables listing tables in database.

    TRUNCATE TABLE  cache_advagg                           ;
    TRUNCATE TABLE  cache_bootstrap                        ;
    TRUNCATE TABLE  cache_config                           ;
    TRUNCATE TABLE  cache_container                        ;
    TRUNCATE TABLE  cache_data                             ;
    TRUNCATE TABLE  cache_default                          ;
    TRUNCATE TABLE  cache_discovery                        ;
    TRUNCATE TABLE  cache_dynamic_page_cache               ;
    TRUNCATE TABLE  cache_entity                           ;
    TRUNCATE TABLE  cache_jsonapi_normalizations           ;
    TRUNCATE TABLE  cache_menu                             ;
    TRUNCATE TABLE  cache_page                             ;
    TRUNCATE TABLE  cache_render                           ;
    TRUNCATE TABLE  cache_rest                             ;
    TRUNCATE TABLE  cache_schema_metatag_cache             ;
    TRUNCATE TABLE  cache_toolbar                          ;
    TRUNCATE TABLE  cachetags ;

    3. Execute router rebuild using druhs.

    drush ev "\Drupal::service('router.builder')->rebuild()"

    4. Clear Cache

    drush cr

Production build 0.69.0 2024