summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/standard/tests/file/ftruncate_bug77081.phpt24
1 files changed, 24 insertions, 0 deletions
diff --git a/ext/standard/tests/file/ftruncate_bug77081.phpt b/ext/standard/tests/file/ftruncate_bug77081.phpt
new file mode 100644
index 0000000000..7a9aa691fb
--- /dev/null
+++ b/ext/standard/tests/file/ftruncate_bug77081.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Bug #77081 ftruncate() changes seek pointer in c mode
+--FILE--
+<?php
+
+$filename = dirname(__FILE__) . DIRECTORY_SEPARATOR . "test77081";
+
+file_put_contents($filename, 'foo');
+$stream = fopen($filename, 'c');
+ftruncate($stream, 0);
+var_dump(ftell($stream));
+fwrite($stream, 'bar');
+fclose($stream);
+var_dump(file_get_contents($filename));
+
+?>
+--CLEAN--
+<?php
+$fn = dirname(__FILE__) . DIRECTORY_SEPARATOR . "test77081";
+unlink($fn);
+?>
+--EXPECT--
+int(0)
+string(3) "bar"