php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48526 When using the b flag i get a error: Warning: fopen(/tmp/12/foo2.txt
Submitted: 2009-06-11 09:26 UTC Modified: 2009-06-19 01:00 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: jason at ovitech dot nl Assigned:
Status: No Feedback Package: Filesystem function related
PHP Version: 5.2.9 OS: OSX
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: jason at ovitech dot nl
New email:
PHP Version: OS:

 

 [2009-06-11 09:26 UTC] jason at ovitech dot nl
Description:
------------
When I open a file with the b flag in it. for example bw I get the error that the file does not exists. That is correct and I want fopen to create the file for me and set the pointer on the beginning of the code. that is why I use the w flag. I have used the b flag because of the note that is underneath the fopen manual file on the site./

Reproduce code:
---------------
$fp = fopen($this->_file, "bw");

Expected result:
----------------
A new file created in /tmp/12 called foo2.txt

Actual result:
--------------
Warning: fopen(/tmp/12/foo2.txt) [function.fopen]: failed to open stream: No such file or directory in /Users/jason/Sites/zf/myclass.php on line 168

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-06-11 20:22 UTC] kalle@php.net
Without looking deeply into this, have you tried with fopen(..., 'wb') instead of bw ?
 [2009-06-12 13:17 UTC] jason at ovitech dot nl
No I did not. Now I have and it seems to work.
But what is the difference? shouldn't have work anyway since these are just flags you pass to the function?
 [2009-06-19 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, 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-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 02 02:01:38 2025 UTC