From 18d9aa4a5911634829cbacd2518978af8fe14045 Mon Sep 17 00:00:00 2001
From: phpipam <miha.petkovsek@telemach.si>
Date: Wed, 20 Dec 2023 10:47:25 +0100
Subject: [PATCH] Fixed RADIUS authentication fails on 1.6.0 #3986

---
 functions/classes/class.Radius.php | 5 +++--
 misc/CHANGELOG                     | 1 +
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/functions/classes/class.Radius.php b/functions/classes/class.Radius.php
index 71e17ed1..21680227 100644
--- a/functions/classes/class.Radius.php
+++ b/functions/classes/class.Radius.php
@@ -576,7 +576,7 @@ class Radius
     function SetAttribute($type, $value)
     {
         $attribute_index = -1;
-        $attribute_count = count($this->_attributes_to_send);
+        $attribute_count = !is_null($this->_attributes_to_send) ? count($this->_attributes_to_send) : 0;
         for ($attributes_loop = 0; $attributes_loop < $attribute_count; $attributes_loop++)
         {
             if ($type == ord(substr($this->_attributes_to_send[$attributes_loop], 0, 1)))
@@ -716,7 +716,8 @@ class Radius
         }
 
         $attributes_content = '';
-        $attribute_count1 = count($this->_attributes_to_send);
+        $attribute_count1 = !is_null($this->_attributes_to_send) ? count($this->_attributes_to_send) : 0;
+
         for ($attributes_loop = 0; $attributes_loop < $attribute_count1; $attributes_loop++)
         {
             $attributes_content .= $this->_attributes_to_send[$attributes_loop];
diff --git a/misc/CHANGELOG b/misc/CHANGELOG
index f9eedbce..77c0f813 100755
--- a/misc/CHANGELOG
+++ b/misc/CHANGELOG
@@ -10,6 +10,7 @@
     + Fixed Update login_form.php for installation inside subdir (#3954);
     + Fixed php8 constructor fix for radius class (#3985);
     + Fixed Force mac address update during status update scan (#3791);
+    + Fixed RADIUS authentication fails on 1.6.0 (#3986);
 
     Enhancements, changes:
     ----------------------------
-- 
GitLab