Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-16891

Controller Helper Routing in ACP can break Extension Installation




      There is a problem when installing some extensions in the ACP, and it is due to the call to the controller helper -> route method for the phpbb_mention_controller.


      In this case the Pages extension has a Custom Route Loader. When you enable Pages extension, you immediately get a fatal PHP error. 


      This is because after enabling, on the supposed Success page, because the phpbb_mention_controller is assigned to the adm_header function globally throughout the ACP, phpBB tries to collect all possible routes, and it therefor also reads the routing.yml of the newly installed Pages extension. However, neither the container nor the cache, yet contains the services of Pages (or any just installed ext), so the compiler is unable to match the Pages route to its custom route loader.

      Cannot load resource "phpbb_pages_new_controller". Make sure there is a loader supporting the "phpbb_pages_route" type.
      in Loader.php line 79
      at Loader->resolve('phpbb_pages_new_controller', 'phpbb_pages_route')
      in FileLoader.php line 139
      at FileLoader->doImport('phpbb_pages_new_controller', 'phpbb_pages_route', false, 'ext/phpbb/pages/config/routing.yml')
      in FileLoader.php line 98
      at FileLoader->import('phpbb_pages_new_controller', 'phpbb_pages_route', false, 'ext/phpbb/pages/config/routing.yml', null)
      in YamlFileLoader.php line 214
      at YamlFileLoader->parseImport(object(RouteCollection), array('resource' => 'phpbb_pages_new_controller', 'type' => 'phpbb_pages_route'), '/Users/matt/Sites/repos/rhea/phpBB/ext/phpbb/pages/config/routing.yml', 'ext/phpbb/pages/config/routing.yml')
      in YamlFileLoader.php line 108
      at YamlFileLoader->load('ext/phpbb/pages/config/routing.yml', 'yaml')
      in DelegatingLoader.php line 40
      at DelegatingLoader->load('ext/phpbb/pages/config/routing.yml', 'yaml')
      in router.php line 132
      at router->get_routes()
      in router.php line 270
      at router->create_dumped_url_generator()
      in router.php line 255
      at router->get_generator()
      in router.php line 184
      at router->generate('phpbb_mention_controller', array(), 1)
      in helper.php line 142
      at helper->route('phpbb_mention_controller', array(), true, false, 1)
      in helper.php line 212
      at helper->route('phpbb_mention_controller')
      in functions_acp.php line 94
      at adm_page_header('Manage extensions')
      in index.php line 83 


      If you ignore this error and reload the page, everything then works fine because the container and cache will finally load the Pages services and can resolve its routes to the the services.


      The most obvious solution would be to NOT set the Mention's route and related VARs globally throughout the ACP, since it's only used in the posting editor. However, this issue could come back if some other routes get assigned later, globally through the ACP via the controller helper. So the other solution may be to actually build the container and/or cache immediately in between extension enabling and showing the resulting Success page, because as of right now, it's not until you load the next page that your newly installed extension actually shows up physically in the ACP and in the containers/caches.


        Issue Links



              Marc Marc
              MattF Matt Friedman
              0 Vote for this issue
              3 Start watching this issue