From:
Operating system: *
PHP version: Irrelevant
Package: SNMP related
Bug Type: Bug
Bug description:read_mib does not return correct response
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 bug report at http://bugs.php.net/bug.php?id=54111&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=54111&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=54111&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=54111&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=54111&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=54111&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=54111&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=54111&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=54111&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=54111&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=54111&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=54111&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=54111&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=54111&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=54111&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54111&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=54111&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=54111&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=54111&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=54111&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=54111&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=54111&r=mysqlcfg