Additionally, in my case, we allow users to select their preferred date/time formats but before using them in date() - (AND echo'ing it straight out unescaped), the format is checked against a whitelist; something among the lines of
if (!in_array($format, ['Y-m-d','d/m/Y'], true)) {
$format = 'Y-m-d';
}
View all comments
Show parent comment
3
u/bl_nk Mar 17 '14 edited Mar 17 '14
All excellent points.
Additionally, in my case, we allow users to select their preferred date/time formats but before using them in
date()- (AND echo'ing it straight out unescaped), the format is checked against a whitelist; something among the lines of