|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21992 snmpget returns wrong value on negative integer
Submitted: 2003-01-31 21:31 UTC Modified: 2003-02-04 18:06 UTC
From: spoon at nexdot dot net Assigned:
Status: Not a bug Package: SNMP related
PHP Version: 4CVS-2003-01-31 (stable) OS: Windows XP Pro SP1
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: spoon at nexdot dot net
New email:
PHP Version: OS:


 [2003-01-31 21:31 UTC] spoon at nexdot dot net
I believe i read somewhere that PHP's integer max was 2147483647?

If using snmp to pull bandwidth information from a device (such as ifInOctets and ifOutOctets), the number DOES constandly rise. If using a device with snmpv1 (32bit) the counter will only reach a certain number before it rolls over the the opposite and negative number and counts toward the maximum again.

The Max (and prolly min?) is the same as PHP's. 

"INTEGER(-2147483648..2147483647) -- corresponds to a signed 32-bit int"

Well, once the counter turns over to the negative, php only returns "2147483647" for every negative value it reads.

Such as, my ifInOctets for my cisco router is now reading '-1980181848', and php's snmpget on that oid returns '2147483647', but when the counter is positive, it returns the correct value.

(this is probably a problem on 64bit snmpv2 since i believe its maximum is much higher, but thats probably not fix-able)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-02-04 15:18 UTC] spoon at nexdot dot net
Any update on this? If it needs more information/some way of confirmation, i would be happy to aid.
 [2003-02-04 17:31 UTC] spoon at nexdot dot net
GRRRR. PHP works FINE. When php grabs the data, it grabs the correct number (even fixes the negative hoopla).

The reason i THOUGHT i was getting an error is becuase i store this data in MYSQL, and it cannot do numbers past the max int either (in an int column), which is why it was stopping at the hieghest number.

 [2003-02-04 17:31 UTC] spoon at nexdot dot net
 [2003-02-04 18:06 UTC]
Not PHP bug -> bogus.

PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sat Apr 04 01:01:23 2020 UTC