ID:              26644
 User updated by: doris dot hahn at landover dot de
 Reported By:     doris dot hahn at landover dot de
-Status:          Feedback
+Status:          Open
 Bug Type:        *Directory/Filesystem functions
 PHP Version:     4.3.4
 New Comment:

yes, magic_quotes_runtime is switched on


Previous Comments:
------------------------------------------------------------------------

[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

Reply via email to