1--TEST-- 2Bug #44818 (php://memory writeable when opened read only) 3--FILE-- 4<?php 5function test($url, $mode) { 6 echo "$url, $mode\n"; 7 $fd = fopen($url, $mode); 8 var_dump($fd, fwrite($fd, "foo")); 9 var_dump(fseek($fd, 0, SEEK_SET), fread($fd, 3)); 10 fclose($fd); 11} 12test("php://memory","r"); 13test("php://memory","r+"); 14test("php://temp","r"); 15test("php://temp","w"); 16?> 17--EXPECTF-- 18php://memory, r 19resource(%d) of type (stream) 20int(0) 21int(0) 22string(0) "" 23php://memory, r+ 24resource(%d) of type (stream) 25int(3) 26int(0) 27string(3) "foo" 28php://temp, r 29resource(%d) of type (stream) 30int(0) 31int(0) 32string(0) "" 33php://temp, w 34resource(%d) of type (stream) 35int(3) 36int(0) 37string(3) "foo" 38