|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #54111 read_mib does not return correct response
Submitted: 2011-02-27 18:04 UTC Modified: 2011-07-23 04:05 UTC
From: jthijsse at noxlogic dot nl Assigned: lytboris (profile)
Status: Not a bug Package: SNMP related
PHP Version: Irrelevant OS: *
Private report: No CVE-ID: None
 [2011-02-27 18:04 UTC] jthijsse at noxlogic dot nl
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:

Expected result:

Actual result:
Warning: snmp_read_mib(): Error while reading MIB file '%s': No such file or directory in %s on line %d


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-02-28 01:11 UTC]
-Assigned To: +Assigned To: lytboris
 [2011-07-23 04:05 UTC]
-Status: Assigned +Status: Bogus
 [2011-07-23 04:05 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

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.
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Sep 30 16:01:24 2020 UTC