Browse Source

Sometimes INTEGER can be negative to.

Luciano Andrade 11 years ago
parent
commit
05cf46a72e
2 changed files with 5 additions and 2 deletions
  1. 2 1
      OSS_SNMP/MIBS/DocsIfCmts.php
  2. 3 1
      OSS_SNMP/SNMP.php

+ 2 - 1
OSS_SNMP/MIBS/DocsIfCmts.php

@@ -152,7 +152,8 @@ accessDenied(7)   The CMTS has sent a Registration Aborted message   to the CM
     }
     }
 
 
     public function docsIfCmtsCmStatusRxPower(){
     public function docsIfCmtsCmStatusRxPower(){
-	return $this->getSNMP()->walk1d(self::OID_docsIfCmtsCmStatusRxPower);
+	$rtr = $this->getSNMP()->walk1d(self::OID_docsIfCmtsCmStatusRxPower);
+	return $rtr;
     }
     }
 
 
     public function docsIfSigQSignalNoise(){
     public function docsIfSigQSignalNoise(){

+ 3 - 1
OSS_SNMP/SNMP.php

@@ -358,10 +358,12 @@ class SNMP
                 break;
                 break;
 
 
             case 'INTEGER':
             case 'INTEGER':
-                if( !is_numeric( $value ) )
+                if( !is_numeric( $value ) and substr($value, 0,1) != '-')
                     $rtn = (float)substr( substr( $value, strpos( $value, '(' ) + 1 ), 0, -1 );
                     $rtn = (float)substr( substr( $value, strpos( $value, '(' ) + 1 ), 0, -1 );
                 else
                 else
                     $rtn = (float)$value;
                     $rtn = (float)$value;
+
+		if($rtn == (int)$rtn) $rtn = (int) $rtn;
                 break;
                 break;
 
 
             case 'Counter32':
             case 'Counter32':