[6.x] add a config setting if all request params should be included in DynamicRoute::handle as template variables #19090
-
|
Currently in Craft 6 all parameters are injected as template variables which is a huge breaking change and might lead to various issues and errors in all my templates. We frequently have optional parameters in the templates we render and check if those variables are defined and otherwise set default values. {% set foo = foo ?? 'some-default' %}However since now all request params are automatically injected we encounter a huge ratio of errors in case users add custom parameters into our system. cms/src/Route/DynamicRoute.php Lines 27 to 43 in 3204d94 Due to $variables = Arr::pull($this->params, 'variables', []) + $request->query->all();we now have to check every variable if it has the correct type and even then we cannot really guarantee it's not injected/overwritten. Could you please add a config setting if those values should be included for site requests or not?` |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Thanks for pointing that out! That was an unintentional change in behavior. Fixed for the next release (96b0327). |
Beta Was this translation helpful? Give feedback.
Thanks for pointing that out! That was an unintentional change in behavior. Fixed for the next release (96b0327).