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

"Backend not Supported" error

Details

Submitted2004-09-11 16:33 UTC
Fromacc_pear at riggers dot me dot uk
Assignedjan
StatusClosed
PackageNet_Ping
PHP Version5.0.0
OSlinux fedora core 2
Roadmaps(Not assigned)

Comments

[2004-09-11 16:33 UTC] acc_pear at riggers dot me dot uk

Description:
------------
Version 2.4 of Net_Ping throws a pear error with message "Backend not supported"

I believe this is down to the change in implementation of get_class_methods() in PHP5 - the strings returned are case-sensitive. This causes the Net_Ping_Result::_prepareParseResult() to fail, as "_parseresultlinux" doesn't exist in the array of class methods.

Suggest

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

is changed to

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

in Net_Ping_Result::_prepareParseResult()

Reproduce code:
---------------
require_once('Net/Ping.php');
$p = Net_Ping::factory();
$res = $p->ping('172.0.0.10');

if( PEAR::isError($res) ) {
echo $res->getMessage();
}

Expected result:
----------------
No error message

Actual result:
--------------
"Backend not Supported"

[2004-09-11 17:16 UTC] acc_pear at riggers dot me dot uk

oops. Of course:
return in_array('_parseResult'.$sysname, $parse_methods);
will break php4...

[2004-09-19 18:09 UTC] acc_pear at riggers dot me dot uk

Patch to fix for both php4 and 5

Index: Ping.php
===================================================================
RCS file: /repository/pear/Net_Ping/Ping.php,v
retrieving revision 1.38
diff -u -r1.38 Ping.php
--- Ping.php 21 Jul 2004 14:27:25 -0000 1.38
+++ Ping.php 19 Sep 2004 12:47:46 -0000
@@ -633,7 +633,7 @@
*/
function _prepareParseResult($sysname)
{
- $parse_methods = array_values(get_class_methods('Net_Ping_Result'));
+ $parse_methods = array_values(array_map('strtolower',get_class_methods('Net_Ping_Result')));

return in_array('_parseresult'.$sysname, $parse_methods);
} /* function _prepareParseResult() */

[2005-03-25 22:19 UTC] bertolinisj at earthlink dot net

This fix for #2314 can also be applied to the NET_Traceroute package as it is plagued by the same bug.

The _prepareParseResult function of the Net_Traceroute_Result Container Class has the same issue and failed for me on win 2000 and XP when using the sample:

Hope this helps
Sergio Bertolini

[2005-09-13 02:00 UTC] ohmer at epita dot info

this bug report is 1 year old and the tarball i installed via pear install Net_Ping is still not patched. will that be done a day ?

[2005-12-18 04:04 UTC] eqguy2002 at yahoo dot com

Thanks for posting the fix. I have been beating my head against my desk trying to figure out the problem.