[php-src] Issue #21318: ext/snmp: Promote 4 E_WARNING to ValueError for invalid input

[email protected] (thomasvincent)
Newsgroups php.bugs
Message-ID <[email protected]>
Issue: https://github.com/php/php-src/issues/21318
Author: thomasvincent

## 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

1. **Malformed IPv6 address** (`snmp_session_init`) — hostname like `[dead:beef::` (missing closing `]`) emits `E_WARNING` instead of throwing `ValueError`.

2. **Type array too short** (`php_snmp_parse_oid`) — when `snmpset()` receives fewer types than OIDs, emits `E_WARNING("no type set")` instead of `ValueError`.

3. **Value array too short** (`php_snmp_parse_oid`) — same pattern as #2 for values.

4. **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.

## PHP Version

master (targeting next minor/major)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.