1--TEST--
2BUG: php://temp does not preserve file-pointer once it switches from memory to temporary file
3--FILE--
4<?php
5
6$f = fopen('php://temp/maxmemory:1024', 'r+');
7fwrite($f, str_repeat("1", 738));
8fseek($f, 0, SEEK_SET);
9fwrite($f, str_repeat("2", 512));
10
11fseek($f, 0, SEEK_SET);
12var_dump(fread($f, 16));
13
14fseek($f, 0, SEEK_END);
15var_dump(ftell($f));
16
17?>
18--EXPECT--
19string(16) "2222222222222222"
20int(738)
21