phpipam icon indicating copy to clipboard operation
phpipam copied to clipboard

Permissions coding error?

Open TotalGriffLock opened this issue 10 months ago • 0 comments

Describe the bug I've sporadically been getting an error viewing a customer after assigning subnets to them. I'm not sure exactly what triggers the bug, as for some customers it happens when they have hit 32 subnets - adding a 33rd causes the 500 error. Other customers of ours have over 220 subnets, but these aren't in parent subnets/nested/folders.

phpIPAM version 1.73

Your Environment (please supply the following information):

  • phpIPAM version: 1.73
  • OS: Ubuntu 22.04.5 LTS
  • PHP version 8.1.2-1ubuntu2.20
  • Webserver nginx/1.18.0 (Ubuntu)
  • Database mysql Ver 8.0.41-0ubuntu0.22.04.1

Steps To Reproduce Please include steps to reproduce the issue:

  1. Create a nested subnet structure. Parent is a folder, in the folder create 2 x /24 subnet with many small subnets (e.g. /29, /30. The customer I found this problem with has a parent folder, 2 x /24 subnets which are then each divided into 21 child subnets)
  2. Create a new customer
  3. Update the existing subnets (parent and child) to belong to that customer. After 32 you will no longer be able to view the customer's info at /ipam/tools/customers/xxx and will instead receive a 500 Internal Server Error.

Screenshots and error logs

PHP message: PHP Warning:  Trying to access array offset on value of type null in /xxx/app/tools/customers/customer/objects/subnets.php on line 118
PHP message: PHP Warning:  Undefined variable $subnet in /xxx/app/tools/customers/customer/objects/subnets.php on line 118
PHP message: PHP Warning:  Trying to access array offset on value of type null in /xxx/app/tools/customers/customer/objects/subnets.php on line 118
PHP message: PHP Warning:  Undefined variable $subnet in /xxx/app/tools/customers/customer/objects/subnets.php on line 118
PHP message: PHP Warning:  Trying to access array offset on value of type null in /xxx/app/tools/customers/customer/objects/subnets.php on line 118
PHP message: PHP Warning:  Undefined variable $subnet in /xxx/app/tools/customers/customer/objects/subnets.php on line 118
PHP message: PHP Warning:  Trying to access array offset on value of type null in /xxx/app/tools/customers/customer/objects/subnets.php on line 118
PHP message: PHP Warning:  Undefined variable $subnet in /xxx/app/tools/customers/customer/objects/subnets.php on line 118
PHP message: PHP Warning:  Trying to access array offset on value of type null in /xxx/app/tools/customers/customer/objects/subnets.php on line 118

Additional Info Line 118 of that file is:

$slave_subnet_permission = $Subnets->check_permission($User->user, $subnet['id']);

I think it should read

$slave_subnet_permission = $Subnets->check_permission($User->user, $slave_subnet['id']);

It is unclear to me why this error only rears its head under certain conditions.

TotalGriffLock avatar Apr 01 '25 10:04 TotalGriffLock