I believe the bug is in lib/api_automation.php's
automation_get_valid_mask($range) function.

It uses bindec() to convert binary to integer, but the result of
bindec() is unsigned integer, or float if it's too big for an
integer[1]. On 32bit turns out it's too big for an integer, a float is
returned, and things break.

On 64bit:
 php ./test.php 24

bindec(11111111111111111111111100000000):
4294967040
Array
(
    [cidr] => 24
    [subnet] => 255.255.255.0
    [count] => 255
)

Same code on 32bits:
ubuntu@f1-armhf:~$ php ./test.php 24

bindec(11111111111111111111111100000000):
4294967040PHP Warning:  long2ip() expects parameter 1 to be int, float given in 
/home/ubuntu/test.php on line 13

Array
(
    [cidr] => 24
    [subnet] => 
    [count] => 255
)


1. https://www.php.net/manual/en/function.bindec.php

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1865067

Title:
  DEP8 error on armhf (32bits): long2ip() requires int

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/cacti/+bug/1865067/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to