This is not really an upgrading issue, but this category fits the best:
Following funny behaviour is not a bug and "related to magic quotes" apparently (that quote was the solution the guys from php.net provided!):
Adding the following to your .htaccess file:
"AddHandler application/x-httpd-php .php"
parses all php files correctly regarding "slash-involved" functions like addslashes, mysql_real_escape_string etc.:
addslashes("O'Brien") results in "O\'Brien" (as it should be, right?)
Adding the 5 to the PHP handler to your .htaccess file :
"AddHandler application/x-httpd-php5 .htm .html .php"
results in 2 extra slashes.
addslashes("O'Brien") results in "O\\'Brien".
Someone told me: well, three slashes is safer than one. That might well be, but these extra slashes don't let themselves get removed by stripslashes!!
Another one told me: look at the magic quotes. Well, ALL magic quotes whatsoever are OFF (doublechecked phpinfo()).
I have searched the manual, the php.net bugreports, multiple forums (basically all over the Internet) for an explanation (or at least someone who experienced the same). No such luck.