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

Checkhost does not work

Details

Submitted2005-11-05 17:16 UTC
Fromjulio2603 at yahoo dot fr
Assignedmj
StatusNo Feedback
PackageNet_Ping
PHP Version5.0.5
OSLinux Debian
Roadmaps(Not assigned)

Comments

[2005-11-05 17:16 UTC] julio2603 at yahoo dot fr

Description:
------------
Hello,
I'm on debian server and php5 with Net_ping (Version 2.4).
I tried to make a script to verify my hosts are up.
So I tried two differents things.( with setArgs and checkhost)
Links of the two scripts are on pastebin.

Thanks for your help

Test script:
---------------
1) http://pastebin.com/418285 (chekhost)
2) http://pastebin.com/418309 (setArgs)

Expected result:
----------------
I want to display the host is up.

Actual result:
--------------
1) For the first script, I have always Host dead but the host is up

2) For the second script I have:
result of ping: [pear_error: message="Backend not Supported" code=4 mode=return level=notice prefix="" info=""]

[2006-01-24 21:33 UTC] pear at dynabyte dot dk

I got the same problem with "Backend not Supported" when I upgraded to PHP 5.

The migrating docs states:

get_class(), get_parent_class() and get_class_methods() now return the name of the classes/methods as they were declared (case-sensitive) which may lead to problems in older scripts that rely on the previous behaviour (the class/method name was always returned lowercased).

Therefore we need to change the case in the function _prepareParseResult() (notice the uppercase R in _parseResult):

return in_array('_parseResult'.$sysname, $parse_methods);

This worked for me...

[2006-03-24 10:56 UTC] h dot j dot m dot wijnen at student dot utwente dot nl

At my Debian box (sarge, php 4.4.2), checkHost also didn't work.
I simply replaced all the preg matching stuff with:

$loss = $res->getLoss();
return ( ($loss == 0) || (($loss < 100) && !$severely) );

Works fine here, and does what it is supposed to do.