Escaping this empty variable necessary?
-
Hi dear forum users,
Within my plugin I output a HTML string if value “hook” is true.
if(hook == true) { $before = '<div class="hook">'; $after = '</div>'; } else { $before = esc_attr(''); $after = esc_attr(''); } echo $before . $some-value . $after;
I know, this is not best coding practice, but I just wondering whether or not it’s necessary to escape the empty variable in this case? Because this value is always empty if “hook” is false. So the variable does not contain anything which can be used as hook by malicious scripts.
Guido
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Escaping this empty variable necessary?’ is closed to new replies.