#29023 [Asn]: fread() only reads 8192 bytes from a local file

2004-07-06 Thread benjcarson at digitaljunkies dot ca
 ID:   29023
 User updated by:  benjcarson at digitaljunkies dot ca
 Reported By:  benjcarson at digitaljunkies dot ca
 Status:   Assigned
 Bug Type: Filesystem function related
 Operating System: Linux
 PHP Version:  5CVS-2004-07-05 (dev)
 Assigned To:  wez
 New Comment:

While I realize that file_get_contents() is faster, the code that lead
me to this bug was not my own.  It was Smarty (2.6.2, although 2.6.3
has the same problem), which has worked very well with PHP5 until now.


Previous Comments:


[2004-07-06 15:26:51] [EMAIL PROTECTED]

I really can't see how this can be CORRECT behaviour as this has worked
(like it says in docs too :) before just fine.

OTOH, you should always use file_get_contents() instead anyway. :)




[2004-07-06 09:14:52] [EMAIL PROTECTED]

Assigning to Wez... although I'd say that this is *correct* behavior,
it shouldn't cause a BC break.



[2004-07-05 22:28:48] benjcarson at digitaljunkies dot ca

Description:

In the latest cvs snap, fread() does not read more than 8192 bytes from
a local file, despite specifying a larger read size as the second
parameter.  If the fread() call is wrapped in a while (!feof) loop the
file can be read correctly, but only 8k at a time.  This contradicts
the first example in the manual
(http://www.php.net/manual/en/function.fread.php) and is a BC break.

As far as I can tell the change was made sometime between the
2004-06-22 snap and the 2004-07-04 snap.

I've tested both using my php.ini file and without (i.e. using the
built-in defaults).  I configured using the following command:

./configure --prefix=/usr --with-apxs=/usr/bin/apxs \
--enable-memory-limit \
--with-layout-GNU\
--enable-bcmath \
--enable-calendar \
--with-curl=/usr \
--enable-exif \
--enable-ftp \
--enable-mbstring \
--enable-shmop \
--enable-sockets \
--enable-sysvsem \
--enable-sysvshm \
--enable-wddx \
--with-bz2 \
--with-config-file-path=/etc/php5/apache \
--with-gd=/usr \
--with-freetype-dir=shared,/usr  \
--with-jpeg-dir=/usr \
--with-png-dir=shared,/usr \
--with-ttf=shared,/usr \
--with-xpm-dir=shared,/usr/X11R6 \
--with-gettext \
--with-kerberos=/usr \
--with-ldap=shared,/usr \
--with-mhash=shared,/usr \
--with-mm \
--with-ncurses=/usr \
--with-openssl=/usr \
--with-pcre-regex=/usr \
--with-pear \
--with-pgsql \
--with-pspell=/usr \
--with-zlib \
--with-zlib-dir=/usr


Reproduce code:
---
#!/usr/bin/php


Expected result:

(the file's actual size, in bytes)

Actual result:
--
8192





-- 
Edit this bug report at http://bugs.php.net/?id=29023&edit=1


#29023 [Asn]: fread() only reads 8192 bytes from a local file

2004-07-06 Thread sniper
 ID:   29023
 Updated by:   [EMAIL PROTECTED]
 Reported By:  benjcarson at digitaljunkies dot ca
 Status:   Assigned
 Bug Type: Filesystem function related
 Operating System: Linux
 PHP Version:  5CVS-2004-07-05 (dev)
 Assigned To:  wez
 New Comment:

I really can't see how this can be CORRECT behaviour as this has worked
(like it says in docs too :) before just fine.

OTOH, you should always use file_get_contents() instead anyway. :)



Previous Comments:


[2004-07-06 09:14:52] [EMAIL PROTECTED]

Assigning to Wez... although I'd say that this is *correct* behavior,
it shouldn't cause a BC break.



[2004-07-05 22:28:48] benjcarson at digitaljunkies dot ca

Description:

In the latest cvs snap, fread() does not read more than 8192 bytes from
a local file, despite specifying a larger read size as the second
parameter.  If the fread() call is wrapped in a while (!feof) loop the
file can be read correctly, but only 8k at a time.  This contradicts
the first example in the manual
(http://www.php.net/manual/en/function.fread.php) and is a BC break.

As far as I can tell the change was made sometime between the
2004-06-22 snap and the 2004-07-04 snap.

I've tested both using my php.ini file and without (i.e. using the
built-in defaults).  I configured using the following command:

./configure --prefix=/usr --with-apxs=/usr/bin/apxs \
--enable-memory-limit \
--with-layout-GNU\
--enable-bcmath \
--enable-calendar \
--with-curl=/usr \
--enable-exif \
--enable-ftp \
--enable-mbstring \
--enable-shmop \
--enable-sockets \
--enable-sysvsem \
--enable-sysvshm \
--enable-wddx \
--with-bz2 \
--with-config-file-path=/etc/php5/apache \
--with-gd=/usr \
--with-freetype-dir=shared,/usr  \
--with-jpeg-dir=/usr \
--with-png-dir=shared,/usr \
--with-ttf=shared,/usr \
--with-xpm-dir=shared,/usr/X11R6 \
--with-gettext \
--with-kerberos=/usr \
--with-ldap=shared,/usr \
--with-mhash=shared,/usr \
--with-mm \
--with-ncurses=/usr \
--with-openssl=/usr \
--with-pcre-regex=/usr \
--with-pear \
--with-pgsql \
--with-pspell=/usr \
--with-zlib \
--with-zlib-dir=/usr


Reproduce code:
---
#!/usr/bin/php


Expected result:

(the file's actual size, in bytes)

Actual result:
--
8192





-- 
Edit this bug report at http://bugs.php.net/?id=29023&edit=1