You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ext/snmp: Promote 4 E_WARNING to ValueError for invalid input #21318
Four validation checks in ext/snmp still emit E_WARNING and return false for invalid input arguments, rather than throwing ValueError as is standard practice since PHP 8.0.
Affected locations
Malformed IPv6 address (snmp_session_init) — hostname like [dead:beef:: (missing closing ]) emits E_WARNING instead of throwing ValueError.
Type array too short (php_snmp_parse_oid) — when snmpset() receives fewer types than OIDs, emits E_WARNING("no type set") instead of ValueError.
Value array too short (php_snmp_parse_oid) — same pattern as JUNIT support #2 for values.
Invalid context engine ID (snmp_session_set_contextEngineID) — non-hex string emits E_WARNING. The existing code already has a // TODO Promote to Error? comment requesting this change.
Notes
The IPv6 validation is called from both the procedural API (hostname = arg 1) and the OO SNMP::__construct (hostname = arg 2). A plain zend_value_error() is appropriate rather than zend_argument_value_error() to avoid showing a wrong argument position.
The generate_Ku() warnings (authentication/privacy key generation, lines ~1089/1105) are intentionally left as E_WARNING since those can fail for runtime reasons (library configuration, unsupported algorithm), not purely bad input.
This is a backward compatibility break: code relying on set_error_handler() + checking for false returns will now get uncaught ValueError exceptions.
Opened PR #21319 to address this:\n\n- Promotes malformed IPv6 host validation from warning to ValueError\n- Promotes missing type/value array entries in snmpset/snmp2_set from warning to ValueError\n- Promotes invalid contextEngineID from warning to ValueError\n\nUpdated tests in ext/snmp/tests accordingly (ipv6, snmpset, snmp2_set, and SNMP::setSecurity error case).
Activity
prateekbhujel commentedon Mar 1, 2026
Opened PR #21319 to address this:\n\n- Promotes malformed IPv6 host validation from warning to
ValueError\n- Promotes missing type/value array entries insnmpset/snmp2_setfrom warning toValueError\n- Promotes invalidcontextEngineIDfrom warning toValueError\n\nUpdated tests inext/snmp/testsaccordingly (ipv6, snmpset, snmp2_set, and SNMP::setSecurity error case).prateekbhujel commentedon Apr 13, 2026
Fixed by #21319, which was merged into
masteron April 6, 2026. I believe this can be closed now.Girgias commentedon Apr 29, 2026
Closing as the linke PR did convert these to ValueErrors