Cannot use object of type PagedRouteCollection used as array

Created on 21 September 2022, about 2 years ago
Updated 14 May 2024, 7 months ago

Problem/Motivation

Steps to reproduce

1. Install module
2. Try to add a new restriction

Proposed resolution

\src\Service\RestrictIpService.php, line no. 322
replace line
elseif (isset($this->allRoutes[$restricted_route_name])) {
with
elseif (isset($this->allRoutes) && is_array($this->allRoutes) && isset($this->allRoutes[$restricted_route_name])) {

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Closed: cannot reproduce

Version

2.0

Component

Code

Created by

🇮🇳India maxdruplex

Live updates comments and jobs are added and updated live.
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.

  • If you look at RouteProviderInterface::getAllRoutes, it returns an array.

      /**
       * Returns all the routes on the system.
       *
       * Usage of this method is discouraged for performance reasons. If possible,
       * use RouteProviderInterface::getRoutesByNames() or
       * RouteProviderInterface::getRoutesByPattern() instead.
       *
       * @return \Symfony\Component\Routing\Route[]
       *   An iterator of routes keyed by route name.
       */
      public function getAllRoutes();
    
Production build 0.71.5 2024