contao / manager-bundle

[READ-ONLY] Contao Manager Bundle
GNU Lesser General Public License v3.0
17 stars 10 forks source link

app_dev.php/profiler does not work with empty url_suffix #37

Closed ghost closed 7 years ago

ghost commented 7 years ago

Issue by @fritzmg June 22nd, 2017, 19:30 GMT

Tested in Contao managed-edition 4.4.0.

  1. Add the following to your app/config/config.yml:
    contao:
    url_suffix: ''
  2. Open the front-end with domain.org/app_dev.php

The Symfony debug bar will not be visible. After a while you will see the following alert:

profiler

If you open the profiler, an exception will be visible:

Contao\CoreBundle\Exception\PageNotFoundException:
Page not found: http://c43me.dev/app_dev.php/_profiler/307a90

  at vendor\contao\core-bundle\src\Resources\contao\controllers\FrontendIndex.php:75
  at Contao\FrontendIndex->run()
     (vendor\contao\core-bundle\src\Controller\FrontendController.php:42)
  at Contao\CoreBundle\Controller\FrontendController->indexAction()
  at call_user_func_array(array(object(FrontendController), 'indexAction'), array())
     (vendor\symfony\symfony\src\Symfony\Component\HttpKernel\HttpKernel.php:153)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
     (vendor\symfony\symfony\src\Symfony\Component\HttpKernel\HttpKernel.php:68)
  at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
     (vendor\symfony\symfony\src\Symfony\Component\HttpKernel\Kernel.php:171)
  at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
     (web\app_dev.php:62)

I am assuming this happens because without an url_suffix the /_profiler/307a90 URL is catched by Contao and treated as a regular page URL (which can then not be found).

ghost commented 7 years ago

Comment by @j0nem June 22nd, 2017, 23:10 GMT

I have a similar issue with an empty url_suffix, but for some reason the 404 alert only occurs if a frontend user is logged in, otherwise everything remains correct. Also I don't get the error posted above when opening the profiler, but simply a message that the token of the request was not found in the database. However, in another setup with empty url_suffix everything works.

ghost commented 7 years ago

Comment by @agoat June 23rd, 2017, 08:29 GMT

I always use url_suffix: "" and have no problems in contao 4.3.x and 4.4.0.

During extension development, I get timeout and not found errors with the symfony debug bar from time to time. But this usually comes from not cleared browser or symfony cache.

ghost commented 7 years ago

Comment by @fenepedia June 23rd, 2017, 09:47 GMT

Do you use the contao standard-edition or managed-edition?

ghost commented 7 years ago

Comment by @fritzmg June 23rd, 2017, 10:01 GMT

My test was done with contao/managed-edition 4.4.0. I have added that info to the initial post.

ghost commented 7 years ago

Comment by @agoat June 23rd, 2017, 10:09 GMT

I'm using the standard-edition. So the problem might be only within the managed-edition.

ghost commented 7 years ago

Comment by @fritzmg June 23rd, 2017, 10:31 GMT

Presumably this happens because in the standard-edition the contao_catch_all route is registered after the _profiler route while in the managed-edition it may not be registered after. This is the debug:router output in both editions:

Contao Standard Edition:

$ php bin/console debug:router
 -------------------------- -------- -------- ------ -----------------------------------
  Name                       Method   Scheme   Host   Path
 -------------------------- -------- -------- ------ -----------------------------------
  _wdt                       ANY      ANY      ANY    /_wdt/{token}
  _profiler_home             ANY      ANY      ANY    /_profiler/
  _profiler_search           ANY      ANY      ANY    /_profiler/search
  _profiler_search_bar       ANY      ANY      ANY    /_profiler/search_bar
  _profiler_info             ANY      ANY      ANY    /_profiler/info/{about}
  _profiler_phpinfo          ANY      ANY      ANY    /_profiler/phpinfo
  _profiler_search_results   ANY      ANY      ANY    /_profiler/{token}/search/results
  _profiler_open_file        ANY      ANY      ANY    /_profiler/open
  _profiler                  ANY      ANY      ANY    /_profiler/{token}
  _profiler_router           ANY      ANY      ANY    /_profiler/{token}/router
  _profiler_exception        ANY      ANY      ANY    /_profiler/{token}/exception
  _profiler_exception_css    ANY      ANY      ANY    /_profiler/{token}/exception.css
  contao_install             ANY      ANY      ANY    /contao/install
  contao_backend             ANY      ANY      ANY    /contao
  contao_backend_login       ANY      ANY      ANY    /contao/login
  contao_backend_password    ANY      ANY      ANY    /contao/password
  contao_backend_preview     ANY      ANY      ANY    /contao/preview
  contao_backend_confirm     ANY      ANY      ANY    /contao/confirm
  contao_backend_file        ANY      ANY      ANY    /contao/file
  contao_backend_help        ANY      ANY      ANY    /contao/help
  contao_backend_page        ANY      ANY      ANY    /contao/page
  contao_backend_popup       ANY      ANY      ANY    /contao/popup
  contao_backend_switch      ANY      ANY      ANY    /contao/switch
  contao_backend_alerts      ANY      ANY      ANY    /contao/alerts
  contao_backend_picker      ANY      ANY      ANY    /_contao/picker
  contao_frontend_cron       ANY      ANY      ANY    /_contao/cron
  contao_frontend_share      ANY      ANY      ANY    /_contao/share
  contao_initialize          ANY      ANY      ANY    /_contao/initialize
  contao_backend_redirect    ANY      ANY      ANY    /contao/
  contao_frontend            ANY      ANY      ANY    /{alias}.html
  contao_index               ANY      ANY      ANY    /
  contao_root                ANY      ANY      ANY    /
  contao_catch_all           ANY      ANY      ANY    /{_url_fragment}
 -------------------------- -------- -------- ------ -----------------------------------

Contao Managed Edition:

$ vendor/bin/contao-console debug:router -e=dev
 -------------------------- -------- -------- ------ -----------------------------------
  Name                       Method   Scheme   Host   Path
 -------------------------- -------- -------- ------ -----------------------------------
  contao_install             ANY      ANY      ANY    /contao/install
  contao_backend             ANY      ANY      ANY    /contao
  contao_backend_login       ANY      ANY      ANY    /contao/login
  contao_backend_password    ANY      ANY      ANY    /contao/password
  contao_backend_preview     ANY      ANY      ANY    /contao/preview
  contao_backend_confirm     ANY      ANY      ANY    /contao/confirm
  contao_backend_file        ANY      ANY      ANY    /contao/file
  contao_backend_help        ANY      ANY      ANY    /contao/help
  contao_backend_page        ANY      ANY      ANY    /contao/page
  contao_backend_popup       ANY      ANY      ANY    /contao/popup
  contao_backend_switch      ANY      ANY      ANY    /contao/switch
  contao_backend_alerts      ANY      ANY      ANY    /contao/alerts
  contao_backend_picker      ANY      ANY      ANY    /_contao/picker
  contao_frontend_cron       ANY      ANY      ANY    /_contao/cron
  contao_frontend_share      ANY      ANY      ANY    /_contao/share
  contao_initialize          ANY      ANY      ANY    /_contao/initialize
  contao_backend_redirect    ANY      ANY      ANY    /contao/
  contao_frontend            ANY      ANY      ANY    /{alias}.html
  contao_index               ANY      ANY      ANY    /
  contao_root                ANY      ANY      ANY    /
  _wdt                       ANY      ANY      ANY    /_wdt/{token}
  _profiler_home             ANY      ANY      ANY    /_profiler/
  _profiler_search           ANY      ANY      ANY    /_profiler/search
  _profiler_search_bar       ANY      ANY      ANY    /_profiler/search_bar
  _profiler_info             ANY      ANY      ANY    /_profiler/info/{about}
  _profiler_phpinfo          ANY      ANY      ANY    /_profiler/phpinfo
  _profiler_search_results   ANY      ANY      ANY    /_profiler/{token}/search/results
  _profiler_open_file        ANY      ANY      ANY    /_profiler/open
  _profiler                  ANY      ANY      ANY    /_profiler/{token}
  _profiler_router           ANY      ANY      ANY    /_profiler/{token}/router
  _profiler_exception        ANY      ANY      ANY    /_profiler/{token}/exception
  _profiler_exception_css    ANY      ANY      ANY    /_profiler/{token}/exception.css
  contao_install_redirect    ANY      ANY      ANY    /install.php
  contao_catch_all           ANY      ANY      ANY    /{_url_fragment}
 -------------------------- -------- -------- ------ -----------------------------------

As expected, the _profiler routes are registered after the contao routes in the managed-edition.

ghost commented 7 years ago

Comment by @aschempp June 23rd, 2017, 10:52 GMT

The profiler is only activ in dev mode, and the Managed Edition console default to prod. Please check again with --env=dev

ghost commented 7 years ago

Comment by @fritzmg June 23rd, 2017, 10:55 GMT

Yes, forgot about that. I have updated my post containing the router output.

ghost commented 7 years ago

Comment by @aschempp June 23rd, 2017, 12:08 GMT

@leofeyer please move this issue to the manager-bundle

aschempp commented 7 years ago

Should be fixed with 2a726c61b146f496709fe2b80008749d52df53a0