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 #2559

Error handling ping output

Details

Submitted2004-10-18 14:23 UTC
Fromjohann dot hoehn at ecommerce dot com
Assignedcconstantine
StatusClosed
PackageNet_Ping
PHP Version4.3.9
OSLinux (Fedora Core 2)
Roadmaps2.4.3

Comments

[2004-10-18 14:23 UTC] johann dot hoehn at ecommerce dot com

Description:
------------
It seems for some reason when Net_Ping executes the ping command it is not capturing stderr at all. This results in some notice messages about $parts being undefined in the function _parseResultlinux().

In _parseResultLinux is automatically subtracts 4 from the line length which can result in the for loop not being triggered and the $parts will be undefined. This can happen when several of the ping packets are blocked causing the output to being signafically less than the function expects.

For example, trying to ping www.microsoft.com results in 5 lines of output and the function will fail the for loop causing $parts to be undefined.

Reproduce code:
---------------
function _parseResultlinux() {
...

print_r($this->_raw_data);

...
}

Actual result:
--------------
Array
(
[0] => PING www.microsoft.com.nsatc.net (207.46.144.188) 32(60) bytes of data.
[1] =>
[2] => --- www.microsoft.com.nsatc.net ping statistics ---
[3] => 4 packets transmitted, 0 received, 100% packet loss, time 3009ms
[4] =>
)