Menu

#118 Visual Inventory error

version 0.8
closed
1
2016-02-02
2014-12-26
Anonymous
No

Howdy!

I'm trying to get our PHPIPAM install up and running, and I'm having a problem with the visual inventory. It keeps saying:

Warning: gmp_add(): Unable to convert variable to GMP - wrong type in /var/www/html/phpipam/site/ipaddr/ipAddressPrintVisual.php on line 33

I have the IP Visual Display Limit let to /22 (and I've tried it at /23 and /24) and it keeps giving me that error.

My subnets are all set at /24.

Any help would be awesome!

Thanks!

Discussion

  • Anonymous

    Anonymous - 2014-12-31

    Hey - just pinging this one to see if anyone is around, or I added the case in right.

    Thanks!!!

     
  • Miha Petkovsek

    Miha Petkovsek - 2014-12-31

    Can you try casting the variable to int?

    after

    $max = $SubnetDetails['subnet'] + $max;
    

    add

    $max = (int) $max;
    
     
  • Anonymous

    Anonymous - 2014-12-31

    Thank you for the reply!

    I added that in, and now under Visual Display its just blank. No warning - its just blank. That section of my .php file now reads:

    $max = MaxHosts($SubnetDetails['mask'], $type);
    $max = $SubnetDetails['subnet'] + $max;
    $max = (int) $max;

     
  • m

    m - 2015-01-02

    Hi.
    I have the same problem on version [v1.1] rev010.
    I tried casting the variable to int as Miha told and after that I have no errors but nothing is shown in the Visual subnet display.

     
  • Miha Petkovsek

    Miha Petkovsek - 2015-01-02

    Do you by any chance have the 32bit system (i386)?

     
  • Miha Petkovsek

    Miha Petkovsek - 2015-01-02

    It seems on 32bit systems integer is too high.

    Remove casting and add this instead:

    print "Max int: ".PHP_INT_MAX."<br>";
    print "Max sbn: ".$max;
    
     
  • Miha Petkovsek

    Miha Petkovsek - 2015-01-02

    This seems to work:

    $max = gmp_strval(gmp_and("0xffffffff", $max));
    

    (add it after)

    $max = $SubnetDetails['subnet'] + $max;
    
     

    Last edit: Miha Petkovsek 2015-01-02
  • Anonymous

    Anonymous - 2015-01-14

    I have the same issue here.

    My ipAddressPrintVisual.php file looks like:

    # get max hosts
    $max = MaxHosts($SubnetDetails['mask'], $type);
    $max = $SubnetDetails['subnet'] + $max;
    $max = gmp_strval(gmp_and("0xffffffff", $max));

    I do have the error now on line 17.

     
  • Anonymous

    Anonymous - 2015-01-28

    Hello,

    Same error in my environement: Debian GNU/Linux 7.6 (wheezy) 32bits

    Alex

     
  • Anonymous

    Anonymous - 2015-01-28

    I tried adding:

    $max = gmp_strval(gmp_and("0xffffffff", $max));
    

    but didn't have any luck. This is the message I am now receiving:

    Warning: gmp_and(): Unable to convert variable to GMP - wrong type in /var/www/site/ipaddr/ipAddressPrintVisual.php on line 17

     
  • Miha Petkovsek

    Miha Petkovsek - 2015-01-28

    Try changing to this, $max gets translated to float:

    $max = gmp_strval(gmp_and("0xffffffff", (int) $max));
    

    brm

     
  • Anonymous

    Anonymous - 2015-01-28

    Casting $max as int as suggested above worked for me. Thanks a bunch Miha!

     
  • Anonymous

    Anonymous - 2015-02-02

    Worked for me too! Thanks too!

     
  • Martin Dummer

    Martin Dummer - 2015-02-10

    Hi,
    I use phpipam-1.1.010 on a 32bit-ubuntu-system, too, and also had this problem.
    Because the posts above show no exact solution here is mine formatted as a patch:

    ~~~~~~
    --- ipAddressPrintVisual.php.orig 2015-02-10 11:53:29.680966189 +0100
    +++ ipAddressPrintVisual.php 2015-02-10 11:56:52.520817175 +0100
    @@ -14,6 +14,7 @@
    # get max hosts
    $max = MaxHosts($SubnetDetails['mask'], $type);
    $max = $SubnetDetails['subnet'] + $max;

    • $max = gmp_strval(gmp_and("0xffffffff", (int) $max));
      # set start and stop values
      $section = getSectionDetailsById($_GET['section']);
      

      ~~~~~~~

    THX for the support!

     
  • Anonymous

    Anonymous - 2015-09-15

    Thanks you Miha Petkovsek and Martin Dummer.
    Kennedy - Brazil

    Ubuntu system 14.04 LTS 32 bits

     
  • Anonymous

    Anonymous - 2015-11-17

    This is worked for me . Thanks Miha.

    $max = MaxHosts($SubnetDetails['mask'], $type);
    $max = $SubnetDetails['subnet'] + $max;
    
    Added this line:
    $max = gmp_strval(gmp_and("0xffffffff", (int) $max));
    
     
  • Miha Petkovsek

    Miha Petkovsek - 2016-02-02
    • Status: open --> closed
     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB