ID: 26644 Updated by: [EMAIL PROTECTED] Reported By: doris dot hahn at landover dot de -Status: Open +Status: Bogus Bug Type: *Directory/Filesystem functions PHP Version: 4.3.4 New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Turn them off and the problem will go away. When this ini setting is enabled any input processed by PHP (such as reading a file) will effectively go through addslashes(). Previous Comments: ------------------------------------------------------------------------ [2003-12-17 11:50:47] doris dot hahn at landover dot de yes, magic_quotes_runtime is switched on ------------------------------------------------------------------------ [2003-12-17 11:20:22] [EMAIL PROTECTED] Do you have magic_quotes_runtime enabled? ------------------------------------------------------------------------ [2003-12-17 05:50:04] doris dot hahn at landover dot de Description: ------------ Hallo everybody, I don't know if the problem I have is a bug or a feature in the new version. I have a PHP skript which reads a text file into an array using the file function. This array than is worked up with an array_walk. The text file contains SQL-statements which should be given to mysql_query. These statements contain apostrophes to mark character strings in SQL. In fewer PHP versions the statements are read as they are in the text file, in the new version back slashes are added to the apostrophes by the file function. So I get an error from mysql, naturally. Is this slash adding a new feature of the file function or is it a bug? If it is a new feature, which special characters are slash added too? The documentation says nothing about that. And there is no answer from the support side. Thank you for your help. Doris Hahn Reproduce code: --------------- <? function sql_query_script ($zeile) { echo "$zeile<br>"; return; } // end function sql_query_script //**** Main ***************************************** $filnam = "x.txt"; $script = file ($filnam); array_walk ($script, "sql_query_script"); ?> Expected result: ---------------- The text file x.txt contains the following line: INSERT INTO Currency VALUES (0,'EUR',1000000) I expect the script to output the following line: INSERT INTO Currency VALUES (0,'EUR',1000000) but the script outputs the following line: INSERT INTO Currency VALUES (0,\'EUR\',1000000) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=26644&edit=1