php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #11294 Incorrect results returned on error
Submitted: 2001-06-05 14:36 UTC Modified: 2001-06-06 01:15 UTC
From: richarde at eskom dot co dot za Assigned:
Status: Closed Package: SNMP related
PHP Version: 4.0.4pl1 OS: Linux Redhat 6.2
Private report: No CVE-ID: None
 [2001-06-05 14:36 UTC] richarde at eskom dot co dot za
Simple code like the code below generates ugly messages in the php code if the host has an error or is unable to connect for some reason:

$networks = snmpwalk('100.100.100.100', 'public', ".1.3.6.1.2.1.4.21.1.1");

These types of errors are shown:

Warning: No Response from 147.110.52.xx in /home/httpd/html/iptrack/test.php3 on line 20

This is in contradiction to what it states in the manual:

array snmpwalk (string hostname, string community, string object_id [, int timeout [, int retries]])
Returns an array of SNMP object values starting from the object_id() as root and false on error.

I think all the snmp functions have the same problems.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-06-06 01:15 UTC] sniper@php.net
This is not a bug. This is how all PHP functions
behave in case of errors. You can set many error
reporting directives in php.ini which control
how the errors are reported. Or you can use @ in front
of function which will make it not to print out any errors:

$networks = @snmpwalk('100.100.100.100', 'public', ".1.3.6.1.2.1.4.21.1.1");

Manual is your friend, read it sometimes.. :)

--Jani

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Oct 11 03:01:27 2024 UTC