|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15200 file() function sometimes adds slashes before single and double quotes
Submitted: 2002-01-24 06:01 UTC Modified: 2002-03-18 00:00 UTC
Avg. Score:4.3 ± 0.9
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: phasme at cicv dot fr Assigned:
Status: No Feedback Package: Filesystem function related
PHP Version: 4.0.6 OS: Linux 2.4 Mandrake 8
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2002-01-24 06:01 UTC] phasme at cicv dot fr
this bug (?) is difficult to encircle and reproduce (and understand), because it appears in a very erratic way.

from time to time, when a file is read with file() and its content displayed line by line with each(), all its single and double quotes are automatically backslashed !
example :
with 'toto.txt' contains :  je n'aime pas ce "bug" !
and the following script :
  $my_file = file('toto.txt');
  while(list(, $my_line) = each($my_file)) {
    echo $my_line;

**sometimes** we get something like :
  je n\'aime pas ce \"bug\" !

(and sometimes not...)


- our system :
  Linux 2.4 (Mdk 8)
  Apache 1.3.22
  PHP 4.0.6 (RPM Mdk)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-01-24 07:25 UTC]
RTM on magic quotes!
 [2002-01-24 08:53 UTC] phasme at cicv dot fr
My scripts remain unchanged, but the results are random... sometimes it works and sometimes it doesn't.

Where *constant* inputs produce *variable* outputs through a *constant* process within a *constant* configuration, can't we speak about bug ?

We have another server with the same version of PHP, the same 'php.ini' file and the same modules and extensions, which works and runs the same scripts without any problem...

For me, it's not a problem with magic quotes configuration.
 [2002-01-24 11:05 UTC]
OK. Reopening.

Please upgrade to the latest version.

Does the same behaviour occur with fopen() or readfile() or other file-functions?
 [2002-01-25 04:45 UTC] phasme at cicv dot fr
This behaviour doesn't seem to occur with fopen() and readfile() functions...
 [2002-02-07 13:29 UTC] ceo at l-i-e dot com
Things *I* would be looking for...

Multiple php.ini files on the server that are somehow being 

.htaccess files that are setting MagicQuotes differently 
depending on what path (especially if symlinks are 
involved) is used to reach the page.

Anything unusual about the server configuration in 
httpd.conf, php.ini, .htaccess, PHP features compiled in 
 [2002-03-18 00:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Mar 06 15:01:23 2021 UTC