Add a function to totally escape params for Db::parseParam #12691
-
When you want to search for certain Elements via ID passed by URL parameter you always have to use a custom where condition. This can be especially annoying after the field suffix change in case we want to find an element based on a unique custom field value. It would be awesome if there was a way to escape all parameters and just use $id = // get the id from somewhere
Element::find()->id(Db::escapeEverything($id))->one(); I know there are functions like Maybe that was your entire point with this function as your literal twig filter might claim this |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Just updated |
Beta Was this translation helpful? Give feedback.
Just updated
Db::escapeParam()
to escape:empty:
and:notempty:
values, andDb::parseParam()
also respects those escaped values, for Craft 4.4 (via #12697).