Yii2: Double view with catchAll in config

Created on 9 Nov 2014  路  4Comments  路  Source: yiisoft/yii2

Sorry for my english.
When add parameter 'catch All' to the config, the called view is displayed in succession twice.
For example, I install Yii2 basic (also true for advanced) and add to /config/web.php next:
'catchAll' => ['site/index'],
And i have double view index in my browser.

minor bug

All 4 comments

This problem occurs when catchAll is enabled with debug module on localhost. Maybe this is not a bug (because it's logically to enable debug in localhost and catchAll in production), but we haven't any info in docs about this and not very beautiful when debug renders body content twice.

Yes, it's caused by the debugger toolbar whose content is served by the catchAll route. We don't have good solution for this. In practice this is also very rare because you won't use debugger in production mode, while catchAll is mostly used in production mode. Closed unless many people are requested for the fix. Thanks.

The assumption that catchAll is mostly only used in production mode is based on its use for maintenance mode (as per the example in the documentation), what about other scenarios that you may want to actually debug.

I am currently working on a user module that has the option to force a user to change their password before they do anything else and this seemed a likely option, noticing the issue led me here.

So how about some form of 'exceptUrls' option that works in conjunction with the catchAll - this would allow the debug URL to be specified as an exception.

It would also mean that in other situations standard error pages (or in my case the option to logout via URL) could also be added t the exception list.

At this point I think I am going to need to use application::beforeActiion or similar and re-create almost exactly the same functionality.

Was this page helpful?
0 / 5 - 0 ratings