Welcome Guest, Not a member yet? Register   Sign In
validation class esaping bug

line 663 in validation.php
return str_replace(array("'", '"', '<', '>'), array("'", "&quot;", '&lt;', '&gt;'), stripslashes($str));

There shouldn't be a stripslashes there right?

Yes why is strip slashes there? If magic quotes is off (as it should be) then stripslashes can create undesireable results.

E.g. if I am writing a message board where user can type code examples, if someone types \" or \' or \\ it shouldn't come back as " or ' or \ if there is an error in the form. This is especially problematic in CI 1.7.0 where strip slashes is applied to $_POST so you don't have access to the original unmodified values that were submitted unless you save them before doing a $this->form_validation->run().

Theme © iAndrew 2016 - Forum software by © MyBB