1--TEST--
2Bug #77081 ftruncate() changes seek pointer in c mode
3--FILE--
4<?php
5
6$filename = dirname(__FILE__) . DIRECTORY_SEPARATOR . "test77081";
7
8file_put_contents($filename, 'foo');
9$stream = fopen($filename, 'c');
10ftruncate($stream, 0);
11var_dump(ftell($stream));
12fwrite($stream, 'bar');
13fclose($stream);
14var_dump(file_get_contents($filename));
15
16?>
17--CLEAN--
18<?php
19$fn = dirname(__FILE__) . DIRECTORY_SEPARATOR . "test77081";
20unlink($fn);
21?>
22--EXPECT--
23int(0)
24string(3) "bar"
25