From:             doris dot hahn at landover dot de
Operating system: 
PHP version:      4.3.4
PHP Bug Type:     *Directory/Filesystem functions
Bug description:  file function works wrong

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 bug report at http://bugs.php.net/?id=26644&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=26644&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=26644&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=26644&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=26644&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=26644&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=26644&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=26644&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=26644&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=26644&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=26644&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=26644&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=26644&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26644&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=26644&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=26644&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=26644&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26644&r=float

Reply via email to