PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Networking » Net_Ping » Bug #2005

Fatal Error when pinging invalid host

Details

Submitted2004-07-28 20:36 UTC
Frommscifo at php dot net
Assignedcellog
StatusClosed
PackageNet_Ping
PHP Version4.3.8
OSRH9
Roadmaps(Not assigned)

Comments

[2004-07-28 20:36 UTC] mscifo at php dot net

Description:
------------
Using...

Net_Ping v2.4
PEAR v1.0b3

Whenever the ping() methods receives an invalid result, it does a PEAR::throwError() call.

PEAR::throwError then calls $this->raiseError(), which isn't defined by Net_Ping. There is a Net_Ping::_raiseError() method, however it doesn't appear to be used at all. Therefore, execution halts since there is no Net_Ping::raiseError() method.

Reproduce code:
---------------
From Net_Ping:

function ping($host) {
<snip>
if (!is_array($this->_result)) {
return PEAR::throwError(NET_PING_FAILED_MSG, NET_PING_FAILED);
}

if (count($this->_result) == 0) {
return PEAR::throwError(NET_PING_HOST_NOT_FOUND_MSG, NET_PING_HOST_NOT_FOUND);
} else {
return Net_Ping_Result::factory($this->_result, $this->_sysname);
}
</snip>
}

From PEAR:

function &throwError($message = null,
$code = null,
$userinfo = null)
{
if (isset($this)) {
return $this->raiseError($message, $code, null, null, $userinfo);
} else {
return PEAR::raiseError($message, $code, null, null, $userinfo);
}
}