-
Notifications
You must be signed in to change notification settings - Fork 8k
Description
Description
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]) emitsE_WARNINGinstead of throwingValueError. -
Type array too short (
php_snmp_parse_oid) — whensnmpset()receives fewer types than OIDs, emitsE_WARNING("no type set")instead ofValueError. -
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 emitsE_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 plainzend_value_error()is appropriate rather thanzend_argument_value_error()to avoid showing a wrong argument position. - The
generate_Ku()warnings (authentication/privacy key generation, lines ~1089/1105) are intentionally left asE_WARNINGsince 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 forfalsereturns will now get uncaughtValueErrorexceptions.
PHP Version
master (targeting next minor/major)