0

I have a PHP installation running 5.3.3 and when I use the code below:

    $sql = file('sql.txt');
    var_dump($sql);

All my single quotes are escaped. Why would this be happening. Magic quotes is enabled on the server (for some reason, it is out of my control) however I thought that magic quotes was only applied to GET POST COOKIE and REQUEST? I there something else I am missing here with the latest PHP?

Any ideas?

Luke
  • 6,195
  • 11
  • 57
  • 85
  • magic quotes shouldnt be the problem, I've tested the same code in the same configuration and works like a charm, no backslashes. If you have no option, use stripslashes() – David Conde Oct 14 '10 at 05:32

2 Answers2

2

magic_quotes_runtime causes this. Thankfully, this "feature" is off by default, but apparently it's enabled on your server.

Matthew Flaschen
  • 278,309
  • 50
  • 514
  • 539
0

From php.net:

If magic_quotes_runtime is enabled, most functions that return data from any sort of external source including databases and text files will have quotes escaped with a backslash.

galymzhan
  • 5,505
  • 2
  • 29
  • 45