Bug #54111 [Asn->Bgs]: read_mib does not return correct response
| From: | lytboris@php.net | Date: | Sat, 23 Jul 2011 08:05:03 +0000 |
| Subject: | Bug #54111 [Asn->Bgs]: read_mib does not return correct response | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-162121@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=54111&edit=1
ID: 54111
Updated by: lytboris@php.net
Reported by: jthijsse at noxlogic dot nl
Summary: read_mib does not return correct response
-Status: Assigned
+Status: Bogus
Type: Bug
Package: SNMP related
Operating System: *
PHP Version: Irrelevant
Assigned To: lytboris
Block user comment: N
Private report: N
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
snmp_read_mib(): this is a Net-SNMP library bug, not php-snmp: read_module_internal() should return
some error if parse(fp, NULL) returned NULL.
And for logging facility you may open a new bug report and attach the patch you propose.
Previous Comments:
------------------------------------------------------------------------
[2011-02-27 18:04:32] jthijsse at noxlogic dot nl
Description:
------------
snmp_read_mib() returns a boolean depending on success of the read. Internally, the reab_mib() call
returns either NULL or the root of the mib-tree, depending on succes. This problem here is that
read_mib ONLY returns NULL when the mib-file is not found and not when there is a parse-error inside
the file. In that case it will just return the mib root tree (which is !null) and thus it will
return true back to the php user.
As a sidenote (maybe a different bug): snmp_disable_stderrlog() does not work 100% for disabling
snmp error logging. Net-snmp wants at least 1 type of log handler active at all times. A simple fix
would be to add snmp_enable_calllog(), so it would use the callback handler for logging (and since
there are no handlers registered, no logging would occur). It would be nicer though to actually have
a callback registered which can return info back to php level (snmp_[clear|get]_log for instance).
The code for this functional and can be supplied as a patch against php5.3 and the new OO api in
trunk.
Test script:
---------------
var_dump(snmp_read_mib("cannotfindthisfile"));
var_dump(snmp_read_mib("incorrectmibfile"));
Expected result:
----------------
bool(false)
bool(false)
Actual result:
--------------
bool(false)
Warning: snmp_read_mib(): Error while reading MIB file '%s': No such file or directory in
%s on line %d
bool(true)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=54111&edit=1