[php-src] PHP-8.6: Merge branch 'PHP-8.5' into PHP-8.6
| From: | David Carlier | Date: | Fri, 20 Nov 2026 08:29:46 +0000 |
| Subject: | [php-src] PHP-8.6: Merge branch 'PHP-8.5' into PHP-8.6 | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-143960@lists.php.net to get a copy of this message | ||
Author: David Carlier (devnexen)
Date: 2026-11-20T08:24:06Z
Commit: https://github.com/php/php-src/commit/8e4d7625f52b5be060e4c9726046640704171614
Raw diff: https://github.com/php/php-src/commit/8e4d7625f52b5be060e4c9726046640704171614.diff
Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
ext/snmp: Fix the hostname and community argument numbers in errors
# Conflicts:
# ext/snmp/snmp.c
Changed paths:
A ext/snmp/tests/snmp_session_init_argument_numbers.phpt
Diff:
diff --git a/ext/snmp/tests/snmp_session_init_argument_numbers.phpt
b/ext/snmp/tests/snmp_session_init_argument_numbers.phpt
new file mode 100644
index 000000000000..0b1e2cae11a2
--- /dev/null
+++ b/ext/snmp/tests/snmp_session_init_argument_numbers.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Errors of the hostname and the community name the right argument
+--EXTENSIONS--
+snmp
+--FILE--
+<?php
+$oid = '.1.3.6.1.2.1.1.5.0';
+$calls = [
+ fn() => snmpget("a\0b", 'public', $oid),
+ fn() => snmpget(str_repeat('a', 300), 'public', $oid),
+ fn() => snmpget('127.0.0.1:99999', 'public', $oid),
+ fn() => snmpget('127.0.0.1', "a\0b", $oid),
+ fn() => snmpget('127.0.0.1', '', $oid),
+ fn() => snmp3_get("a\0b", 'user', 'noAuthNoPriv',
'', '', '', '', $oid),
+ fn() => snmp3_get('127.0.0.1', '', 'noAuthNoPriv',
'', '', '', '', $oid),
+ fn() => new SNMP(SNMP::VERSION_2C, "a\0b", 'public'),
+ fn() => new SNMP(SNMP::VERSION_2C, '127.0.0.1', ''),
+];
+foreach ($calls as $call) {
+ try {
+ $call();
+ } catch (ValueError $e) {
+ echo $e->getMessage(), "\n";
+ }
+}
+?>
+--EXPECT--
+snmpget(): Argument #1 ($hostname) must not contain any null bytes
+snmpget(): Argument #1 ($hostname) length must be lower than 128
+snmpget(): Argument #1 ($hostname) remote port must be between 0 and 65535
+snmpget(): Argument #2 ($community) must not contain any null bytes
+snmpget(): Argument #2 ($community) must not be empty
+snmp3_get(): Argument #1 ($hostname) must not contain any null bytes
+snmp3_get(): Argument #2 ($security_name) must not be empty
+SNMP::__construct(): Argument #2 ($hostname) must not contain any null bytes
+SNMP::__construct(): Argument #3 ($community) must not be empty