Mysteriously added backslashes

Remove unwanted backslashes added to form code.

Overview

The issue is caused by the deprecated PHP setting 'magic_quotes_gpc' being enabled on the server.
Disable magic quotes by adding a directive to turn it off in your server configuration, such as in an .htaccess file.

Answered
He HerKle 12 Jan, 2015
Hi,
when working on my local development (xampp, joomla 2.5, php 5.3), all fields with php code add a slash prior to quotation mark, which makes code like
return date('Y-m-d');
look as
return date(\'Y-m-d\');
causing of course disfunction and errors – and with each saving adding more and more backslashes, so that I even found some
return date(\\\\\\\'Y-m-d\\\\\\\');
.
In the live environment (joomla 2.5, php 5.4) this doesn't happen. Is that a bug which has to do with php version or what else might cause that? Thankful for any comment,
Herbert
es esl 13 Jan, 2015
1 Likes
I just saw this for a quick second and it I got a message saying something about magic quotes then I removed them and it was all good, it was on hostgator hosting
He HerKle 13 Jan, 2015
Answer
Thanks, esl! They were activated in some .htaccess file.
So I switched
php_flag magic_quotes_gpc off

and everything is working fine again.
This topic is locked and no more replies can be posted.