suggested improvement for bug21131.phpt
| From: | David Hill | Date: | Thu, 13 Mar 2003 21:00:53 +0000 |
| Subject: | suggested improvement for bug21131.phpt | ||
| Groups: | php.qa | ||
| Request: | Send a blank email to php-qa+get-10080@lists.php.net to get a copy of this message | ||
Hi,
while looking at a reported bug, I found that
ext/standard/tests/file/bug21131.phpt
almost tested the reported case. The report was that fopen("","a+") was not going to the end. When looking at the test case, I could see that the test was using "a+", but as it was not writing anything at that point, it seemed to not test my case..... With the addition of one line and a slight change to the output, I found that I had a good test case and that I could not reproduce the problem :-). Perhaps you might like to add my changes to the test (or let me know and I will make the change).
As changed:
--TEST--
Bug #21131: fopen($filename, "a+") has broken position
--FILE--
<?php # vim600:syn=php:
$filename = tempnam("/tmp", "phpt");
$fp = fopen($filename, "w") or die("can't open $filename for append");
fwrite($fp, "foobar");
fclose($fp);
$fp = fopen($filename, "a+");
fwrite($fp, "FOOBAR"); /* changed line */rewind($fp); fpassthru($fp); fclose($fp); unlink($filename); ?> --EXPECT-- foobarFOOBAR