|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44818 php://memory writeable when opened read only
Submitted: 2008-04-24 12:45 UTC Modified: 2008-11-11 00:45 UTC
Avg. Score:3.7 ± 0.5
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:1 (33.3%)
From: davemastergeneral at gmail dot com Assigned:
Status: Closed Package: Streams related
PHP Version: 5.2CVS-2008-04-24 (snap) OS: Linux csl1226 2.6.22-14-generic
Private report: No CVE-ID:
 [2008-04-24 12:45 UTC] davemastergeneral at gmail dot com
I use php://memory to save resources when unit testing, I found it possible to write to the stream despite opening it read only. Not sure if this is the desired behaviour.

Reproduce code:
 * php://memory bug 

$fh = fopen('php://memory', 'r');
var_dump(fwrite($fh, 'dave'));


Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-04-25 08:12 UTC] davemastergeneral at gmail dot com
Actually, expected result should be


For an error?
 [2008-10-30 17:06 UTC]
Please try using this CVS snapshot:
For Windows:

 [2008-11-07 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".
 [2008-11-10 09:33 UTC] davemastergeneral at gmail dot com
echo phpversion(), PHP_EOL;
$fh = fopen('php://memory', 'r');
var_dump(fwrite($fh, 'dave'));

Actual result:


Expected result:

 [2008-11-10 09:34 UTC] davemastergeneral at gmail dot com
Provided Feedback
 [2008-11-11 00:45 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Tue Dec 01 18:01:33 2015 UTC