|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2008-04-24 12:45 UTC] davemastergeneral at gmail dot com
Description:
------------
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
/**
* php://memory bug
*/
$fh = fopen('php://memory', 'r');
var_dump(fwrite($fh, 'dave'));
?>
Expected result:
----------------
int(0)
Actual result:
--------------
int(4)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 22:00:01 2025 UTC |
<?php echo phpversion(), PHP_EOL; $fh = fopen('php://memory', 'r'); var_dump(fwrite($fh, 'dave')); ?> Actual result: 5.2.7RC4-dev int(4) Expected result: 5.2.7RC4-dev bool(false)