Skip to content

SNMP second GET not work on 8.5.1 (wok ok on 8.5.0) #21132

@safelock1

Description

@safelock1

### Description

Affected Page URL
no

Describe the bug
In php I use snmp get

$session = new SNMP(SNMP::VERSION_2c, '10.55.42.100', $snmp,300000,3);
  $suma=805912320;
  list($nic,$signal) = explode('"',$session->get("1.3.6.1.4.1.3902.1015.1010.1.1.1.29.1.5.$suma"));  **//<-this work ok**
  list($nic,$onoff) = explode(':',$session->get("1.3.6.1.4.1.3902.1015.1010.1.7.4.1.17.$suma"));   **//<-not ok and next not work. no error**
  list($nic,$updown) = explode(':',$session->get("1.3.6.1.4.1.3902.1015.1010.1.1.1.5.1.2.$suma.1"));
  list($nic,$deregister) = explode('"',$session->get("1.3.6.1.4.1.3902.1015.1010.1.7.4.1.16.$suma"));
  list($nic,$register) = explode('"',$session->get("1.3.6.1.4.1.3902.1015.1010.1.7.4.1.12.$suma"));
  list($nic,$deregister_powod) = explode(':',$session->get("1.3.6.1.4.1.3902.1015.1010.1.7.4.1.17.$suma"));
  list($nic,$ven) = explode('"',$session->get("1.3.6.1.4.1.3902.1015.1010.1.1.1.1.1.2.$suma"));
  list($nic,$pasmod) = explode('"',$session->get("1.3.6.1.4.1.3902.1015.1010.5.5.1.29.$suma"));

echo "$signal<br>$onoff<br>$updown<br>$register<br>$ven"

Response on php8.5.1 and php8.5.2:

-22.29148<br><br><br><br>

Response on php8.5.0:

-22.29148<br> 3<br> 1<br>2026/01/28 18:49:19<br>ZTE

In PHP 8.5.0, everything works fine; it reads every SNMP.
After updating to 8.5.2 (and 8.5.1), it only reads the first GET request, and any subsequent ones are not processed. Reverting to 8.5.0 starts working correctly.
Both PHP 8 versions compiled with the same src parameters

Steps to reproduce

list($nic,$signal) = explode('"',$session->get("1.3.6.1.4.1.3902.1015.1010.1.1.1.29.1.5.$sum")); - its OK
list($nic,$oltrx) = explode(':',$session->get("1.3.6.1.4.1.3902.1015.1010.11.2.1.2.".$olt_rx[$rack."/".$card."/".$slot]."."$onu)); **- not read**
list($nic,$onoff) = explode(':',$session->get("1.3.6.1.4.1.3902.1015.1010.1.7.4.1.17.$sum")); **not read**

If I first get and close session, next open and read and close then work. On one session not working good.

Expected behavior
SNMP GET should retrieve every snmp oid, not just the first command executed

Screenshots
No response

Additional context
No response

PHP Version

PHP 8.5.1 (cli) (built: Feb  4 2026 19:35:46) (ZTS)
Copyright (c) The PHP Group
Zend Engine v4.5.1, Copyright (c) Zend Technologies
    with Zend OPcache v8.5.1, Copyright (c), by Zend Technologies

php modules:

router:/var/www/lms/test# php8 -m
[PHP Modules]
bcmath
Core
ctype
curl
date
dom
exif
fileinfo
filter
gd
gmp
hash
iconv
intl
json
ldap
lexbor
libxml
mbstring
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
random
Reflection
session
SimpleXML
snmp
soap
sockets
sodium
SPL
standard
tokenizer
uri
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache

var_dump($session):


Open session:
object(SNMP)#1 (8) {
  ["info"]=>
  array(3) {
    ["hostname"]=>
    string(12) "10.55.42.100"
    ["timeout"]=>
    int(300000)
    ["retries"]=>
    int(3)
  }
  ["max_oids"]=>
  NULL
  ["valueretrieval"]=>
  int(0)
  ["quick_print"]=>
  bool(false)
  ["enum_print"]=>
  bool(false)
  ["oid_output_format"]=>
  int(0)
  ["oid_increasing_check"]=>
  bool(true)
  ["exceptions_enabled"]=>
  int(0)
}

first get:

object(SNMP)#1 (8) {
  ["info"]=>
  array(3) {
    ["hostname"]=>
    string(12) "10.55.42.100"
    ["timeout"]=>
    int(300000)
    ["retries"]=>
    int(3)
  }
  ["max_oids"]=>
  NULL
  ["valueretrieval"]=>
  int(0)
  ["quick_print"]=>
  bool(false)
  ["enum_print"]=>
  bool(false)
  ["oid_output_format"]=>
  int(0)
  ["oid_increasing_check"]=>
  bool(true)
  ["exceptions_enabled"]=>
  int(0)
}

second get:

object(SNMP)#1 (8) {
  ["info"]=>
  array(3) {
    ["hostname"]=>
    string(12) "10.55.42.100"
    ["timeout"]=>
    int(300000)
    ["retries"]=>
    int(3)
  }
  ["max_oids"]=>
  NULL
  ["valueretrieval"]=>
  int(0)
  ["quick_print"]=>
  bool(false)
  ["enum_print"]=>
  bool(false)
  ["oid_output_format"]=>
  int(0)
  ["oid_increasing_check"]=>
  bool(true)
  ["exceptions_enabled"]=>
  int(0)
}

Operating System

NET-SNMP Version 5.9.4.pre2
OS: Debian kernel compiled 6.1.135
Not work on apache2.4.66 (and cli php8)
Compiled via GCC-13

Compiled configuration php8.5.XX:

'./configure' '--prefix=/opt/php/php8' '--enable-cli' '--enable-fpm' '--enable-enable-opcache' '--enable-sockets' '--enable-soap' '--with-curl' '--with-freetype' '--with-fpm-user=www-data' '--with-fpm-group=www-data' '--with-jpeg' '--with-mysql-sock' '--with-mysqli' '--with-openssl' '--with-pdo-mysql' '--with-xsl' '--with-zlib' '--with-apxs2=/usr/bin/apxs' '--program-suffix=8' '--without-sqlite3' '--without-pdo-sqlite' '--enable-zts' '--with-snmp' '--enable-mbstring' '--with-mbstring' '--enable-gd' '--enable-exif' '--disable-phpdbg' '--with-apxs2=/opt/apache2/usr/bin/apxs' '--with-gmp' '--enable-intl' '--with-ldap' '--enable-pcntl' '--with-password-argon2' '--with-sodium' '--enable-bcmath' '--with-zip'

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions