Skip to content

Commit f2dec0b

Browse files
committed
Make SNMP shut up properly
1 parent ba180e6 commit f2dec0b

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

ext/snmp/snmp.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1997,6 +1997,13 @@ PHP_MINIT_FUNCTION(snmp)
19971997
{
19981998
netsnmp_log_handler *logh;
19991999

2000+
/* Disable logging, use exit status'es and related variabled to detect errors */
2001+
shutdown_snmp_logging();
2002+
logh = netsnmp_register_loghandler(NETSNMP_LOGHANDLER_NONE, LOG_ERR);
2003+
if (logh) {
2004+
logh->pri_max = LOG_ERR;
2005+
}
2006+
20002007
init_snmp("snmpapp");
20012008
/* net-snmp corrupts the CTYPE locale during initialization. */
20022009
zend_reset_lc_ctype_locale();
@@ -2006,13 +2013,6 @@ PHP_MINIT_FUNCTION(snmp)
20062013
netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DONT_PERSIST_STATE, 1);
20072014
#endif
20082015

2009-
/* Disable logging, use exit status'es and related variabled to detect errors */
2010-
shutdown_snmp_logging();
2011-
logh = netsnmp_register_loghandler(NETSNMP_LOGHANDLER_NONE, LOG_ERR);
2012-
if (logh) {
2013-
logh->pri_max = LOG_ERR;
2014-
}
2015-
20162016
memcpy(&php_snmp_object_handlers, &std_object_handlers, sizeof(zend_object_handlers));
20172017
php_snmp_object_handlers.read_property = php_snmp_read_property;
20182018
php_snmp_object_handlers.write_property = php_snmp_write_property;

ext/snmp/tests/bug64159.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,4 @@ var_dump(("ab8283f948419b2d24d22f44a80b17d3" === md5(snmpget($hostname, $communi
2222

2323
?>
2424
--EXPECTF--
25-
MIB search path: %s
26-
Cannot find module (noneXistent): At line %d in (%s)
2725
bool(true)

0 commit comments

Comments
 (0)