ID: 10229
User Update by: [EMAIL PROTECTED]
Old-Status: Closed
Status: Open
Bug Type: Filesystem function related
Operating system: linux 2.2.14C11
PHP Version: 4.0.3pl1 4.0.4pl1 4.0.5 4.0.6
Description: buffer error in fread

This error still exists, not de phpcode part, but the buffering errors, try this 
several times:

---start---
$fp = fopen("http://www.planetinternet.be/nl/vandaag/";, "r");
$content = fread($fp, 100000);
fclose($fp);

$fp = fopen("http://www.google.com/";, "r");
$content = fread($fp, 100000);

mail("me@host", "topic", $content);
---stop---

This is an error in the buffer handling routines and should be eliminated.  It seems 
to occur at _every_ request with php4.0.6 !

Previous Comments:
---------------------------------------------------------------------------

[2001-04-27 15:34:42] [EMAIL PROTECTED]

I assume this is a dead issue.  If not reopen.

-Chris

---------------------------------------------------------------------------

[2001-04-08 05:04:10] [EMAIL PROTECTED]

I have only seen php code once, and I was't able to reproduce it.  I suppose it was a 
case where php code was stored in a variable (for online editing or something).  This 
is only a guess, as it's not my code that I see, but code from someone else on the 
same server.

---------------------------------------------------------------------------

[2001-04-07 20:51:58] [EMAIL PROTECTED]

I ran it through a couple hundred times and absolutely no PHP code whatsoever.

The only problem I see here is $content is never cleaned up properly and contains BOTH 
of the fread()s jumbled.  Which is very strange.

$fp = fopen("http://www.newsplanet.be/";, "r");
while (!feof($fp)) $content .= fread($fp, 4000);
fclose($fp);

You would be better off using the above as it works properly.

Whomever is handling the fopen-wrappers should probably look at this.

-Chris

---------------------------------------------------------------------------

[2001-04-07 20:17:03] [EMAIL PROTECTED]

I've been testing a bit more and have a clear reproducible codesnippet, it yields the 
same results in php 4.0.4p1, so I changed the PHP version for this bugreport.

---start---
$fp = fopen("http://www.newsplanet.be/";, "r");
$content = fread($fp, 100000);
fclose($fp);

$fp = fopen("http://www.google.com/";, "r");
$content = fread($fp, 100000);

mail("me@host", "topic", $content);
---stop---

In this mail, I see the sourcecode from google.com followed by the rest of the code 
from newsplanet.be.  This does occur in about 1/3 of the mails I try, although I'm 
unable to see why this isn't always the case.


---------------------------------------------------------------------------

[2001-04-07 19:46:47] [EMAIL PROTECTED]

Can't reproduce with CVS version.  Try upgrading to the newest release 4.04pl1 or grab 
a CVS snapshot from http://snaps.php.net/

What URL is it that is doing this? Or is it every URL?

-Chris

---------------------------------------------------------------------------

The remainder of the comments for this report are too long.
To view the rest of the comments, please
view the bug report online.

Full Bug description available at: http://bugs.php.net/?id=10229


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to