php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38589 fwrite() writes some extra '\'
Submitted: 2006-08-25 08:24 UTC Modified: 2006-08-25 11:48 UTC
From: tennysonvarghese at gmail dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 4.4.4 OS: Debian linux 2.6.15-1-686
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: tennysonvarghese at gmail dot com
New email:
PHP Version: OS:

 

 [2006-08-25 08:24 UTC] tennysonvarghese at gmail dot com
Description:
------------
fwrite() prepends '\' if is there any '," or \ . PHP tries to write a '\' for every inclusion of the above characters.

Reproduce code:
---------------
<form name="frmFile" method="post" action="test.php">
<textarea name="txtFile" rows=5>
<?= $_POST['txtFile']; ?>
</textarea>
<input type = submit value="Test" > 
</form>

<?php
 if(isset($_POST['txtFile'])){
  $data = $_POST['txtFile'];
  fwrite($fp, $data);
  fclose ($fp);
 }
?>

Expected result:
----------------
i expect to remove the extra slash('\') and get the file as what i write in the text area.

Actual result:
--------------
this is \\\\\\\'\\\\\\\'  test \\\\\\\\

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-08-25 08:56 UTC] tony2001@php.net
Turn off magic_quotes.
 [2006-08-25 11:38 UTC] tennysonvarghese at gmail dot com
thanks for the help.. i put off the magic quotes as you suggest.. now i get the solution
 [2006-08-25 11:46 UTC] tony2001@php.net
Not PHP problem -> bogus.
 [2006-08-25 11:47 UTC] tennysonvarghese at gmail dot com
i'm sorry.. i understand its not a bug..
i turn off the magic quotes and now its alright.. 
magic_quotes_gpc = Off
 [2006-08-25 11:48 UTC] tennysonvarghese at gmail dot com
ok
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 16 16:01:34 2025 UTC