1

I have checked both get_magic_quotes_gpc() and get_magic_quotes_runtime() in my PHP code, and they are not turned on, but I am still getting single quotes stored in MySQL as "\'" when using Propel.

I don't want to have to use stripslashes() if I can avoid it. Is there something that I am doing incorrectly here?

$emp = new Employers();
$emp->setCompanyname($companyname);
$emp->save();

Joe's Company is stored as Joe\'s Company in MySQL.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
user307170
  • 31
  • 1
  • Have you tried inspecting the values *before* you save them to the database? – tadman Oct 04 '13 at 17:47
  • I have never seen that happen before but yes, the postdata coming in already has the single quote escaped with a backslash. Very strange behavior. Does anyone know how to prevent that from happening? – user307170 Oct 04 '13 at 23:21
  • Found the solution, seems that the WP site uses this silly feature. No other methods seem to be able to turn this off except the solution here. http://stackoverflow.com/questions/8949768/with-magic-quotes-disabled-why-does-php-wordpress-continue-to-auto-escape-my and here http://codex.wordpress.org/Function_Reference/stripslashes_deep – user307170 Oct 05 '13 at 00:06
  • 3
    Does this answer your question? *[With "magic quotes" disabled, why does PHP/WordPress continue to auto-escape my POST data?](https://stackoverflow.com/questions/8949768/with-magic-quotes-disabled-why-does-php-wordpress-continue-to-auto-escape-my)* – Peter Mortensen Dec 01 '19 at 14:21

0 Answers0