Search code examples
phpfilequotesmagic-quotes

PHP file() adding slashes to single quotes


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?


Solution

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