Just tried it... Nope 🙁
Heres the code I'm passing my $POST through (Just the $POST that users have control of / that enter mysql)
function strip_array($data, $filter_type = 2) {
print "<br>";
if (is_array($data)) {
array_map(array($this,"strip_array"), $data);
print "Itsa an array!<br>";
} else {
if (get_magic_quotes_gpc()) {
$data = stripslashes($data);
$data = str_replace("\\", "", $data);
print $data."<br>Pesky slashes<Br>";
}
$data = mysql_real_escape_string(strip_tags(trim($data)));
$data = htmlentities($data);
}
return $data;
}
Readout:
apply
Pesky slashes
asdf'asd'fas'df
Pesky slashes
asdf'asdf'
Pesky slashes
asdf'asdf'
Pesky slashes
asdf'asd'fa'sdf'asdf'
Pesky slashes
asdf'as'dfas'df
Pesky slashes
1
Pesky slashes
Itsa an array!
Pesky slashes
1
Pesky slashes
Submit
Pesky slashes
Now heres the reason why I'm pulling my hair out:
(What happens when I serialize it)
a:6:{s:4:"name";s:18:"asdf'asd'fas'df";s:5:"alias";s:12:"asdf'asdf'";s:5:"hours";s:12:"asdf'asdf'";s:10:"experience";s:26:"asdf'asd'fa'sdf'asdf'";s:8:"why_hire";s:18:"asdf'as'dfas'df";s:9:"positions";a:1:{i:0;s:1:"1";}}
Notice how serialize seems to think theres \'s in front of '... But it doesn't actually save them...
Edit:
I looked into it more and its not the $_POST portion, its the serialization portion... It doesn't see slashes when it tries to serialize, possibly because of magical_quotes.... I can clearly see the slashes when I print, but when I serialize it, it doesn't save them... It just counts them when it serializes, so the count is always 1 higher for every escapable character, then the actual value.
So basically... A string like:
I'm annoyed
Would be counted as 12 instead of 11, since theres a '... Serialize's count sees ' as \', but saves it as '
So... Er, how do I fix this?