#21131 [Opn->Asn]: fopen with "a+" and the a rewind does'nt work anymore
| From: | sniper@php.net | Date: | Mon, 03 Feb 2003 06:13:37 +0000 |
| Subject: | #21131 [Opn->Asn]: fopen with "a+" and the a rewind does'nt work anymore | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-31925@lists.php.net to get a copy of this message | ||
ID: 21131
Updated by: sniper@php.net
Reported By: hgj@xs4all.nl
-Status: Open
+Status: Assigned
Bug Type: Filesystem function related
Operating System: Linux 2.4.18 (Redhat)
PHP Version: 4.3.0RC4
Assigned To: wez
Previous Comments:
------------------------------------------------------------------------
[2003-02-02 15:30:23] michael.mauch@gmx.de
Also on other systems (Solaris, some Linux versions). I think that test
case is a bit wrong. There's no guarantee in the C standard that
ftell() will point to the end of the file directly after
fopen(...,"a+"). You are guaranteed that you can read from anywhere in
the file, and that you can't overwrite anything in the file - writes go
always to the end of the file, no matter how hard you fseek() or
fsetpos().
Please see also:
<http://groups.google.de/groups?q=fopen+a%2B+ftell+Debian&hl=de&lr=&ie=UTF-8&scoring=d&selm=20030108144007%242401%40gated-at.bofh.it&rnum=1>
<http://groups.google.de/groups?q=fopen+a%2B+debian+closed&hl=de&lr=&ie=UTF-8&scoring=d&selm=handler.107966.D107966.101008948313895.ackdone%40bugs.debian.org&rnum=1>
------------------------------------------------------------------------
[2003-02-02 14:35:16] k.schroeder@php.net
ext/standard/tests/file/bug21131.phpt failed on W2k server with
latetest win32-snap:
---- EXPECTED OUTPUT
int(6)
int(0)
foobar
---- ACTUAL OUTPUT
int(0)
int(0)
foobar
---- FAILED
------------------------------------------------------------------------
[2002-12-22 12:16:59] iliaa@php.net
This bug has been fixed in CVS.
In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.
------------------------------------------------------------------------
[2002-12-21 08:25:00] hgj@xs4all.nl
With 4.2.3 and below the next code did give the contents of $file only
when the Apache runtime user was allowed to update that file. Now it
nevers gives the content of the file anymore.
$fp = fopen($file,"a+");
rewind($fp);
$fstr = fread($fp, filesize($file));
The PHP version box did not give 4.3.0RC4, but it's still there.
./configure --with-openssl --enable-cli --prefix=/www --with-mcrypt
--with-config-file-path=/www/conf --with-mysql
--with-apache=../apache_1.3.27 --enable-track-vars --with-gzlib
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=21131&edit=1