|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-02-28 01:11 UTC] cataphract@php.net
-Assigned To:
+Assigned To: lytboris
[2011-07-23 04:05 UTC] lytboris@php.net
-Status: Assigned
+Status: Bogus
[2011-07-23 04:05 UTC] lytboris@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 07 15:00:01 2025 UTC |
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)