[php-src] PR #25590: Fix the argument numbers of the hostname and community errors in snmp functions

From: Date: Thu, 19 Nov 2026 13:32:13 +0000
Subject: [php-src] PR #25590: Fix the argument numbers of the hostname and community errors in snmp functions
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-40810@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/25590 Author: lacatoire snmp_session_init() reports the hostname as argument 2 and the community as argument 3, which is only right for SNMP::__construct(). The procedural functions take the hostname first, so snmpget() and the other snmp functions name the wrong parameter. Pass the position of the hostname instead, as master already does. ### To reproduce ```php <?php try { snmpget("a\0b", 'public', '.1.3.6.1.2.1.1.5.0'); } catch (ValueError $e) { echo $e->getMessage(), "\n"; } try { snmpget('127.0.0.1', '', '.1.3.6.1.2.1.1.5.0'); } catch (ValueError $e) { echo $e->getMessage(), "\n"; } ``` php repro.php on PHP 8.5.4 Before: ``` snmpget(): Argument #2 ($community) must not contain any null bytes snmpget(): Argument #3 ($object_id) must not be empty ``` After: ``` snmpget(): Argument #1 ($hostname) must not contain any null bytes snmpget(): Argument #2 ($community) must not be empty ```

« previous php.git-pulls (#40810) next »