Home » Networking » Net_Socket » Bug #6789
Net_Sock::eof() returns false when socket is already disconnected
Details
| Submitted | 2006-02-15 10:21 UTC |
|---|---|
| From | satanistlav at mail dot ru |
| Assigned | cweiske |
| Status | Closed |
| Package | Net_Socket |
| PHP Version | 5.0.5 |
| OS | Win XP |
| Roadmaps | (Not assigned) |
Comments
[2006-02-15 10:21 UTC] satanistlav at mail dot ru
Description:
------------
Net_Sock::eof() returns false when socket is already disconnected in HTTP_Request class line 1040
Test script:
---------------
class myListener extends HTTP_Request_Listener{
function update(&$subject, $event, $data = null){
if ($event == 'gotHeaders'){
$subject->_sock->disconnect();
//should disconnect after recieving headers but it wil l not
}elseif($event == 'gotBody'){
echo $data;
}
}
}
$request = new HTTP_Request('http://www.php.net/');
$request->attach(new myListener());
$request->sendRequest();
Expected result:
----------------
It should stop and should not download the the page body
Actual result:
--------------
FATAL: erealloc(): Unable to allocate nnnnnn bytes.
[2006-02-15 10:30 UTC] satanistlav at mail dot ru
it works fine when I change the code as below
function eof()
{
if (!is_resource($this->fp)) {
return true;
}
return feof($this->fp);
}