From e9300cf1bc18339e5ce40bf139ec57166909d3f9 Mon Sep 17 00:00:00 2001 From: Koji NAKAMURA Date: Sat, 9 Nov 2024 09:08:02 +0900 Subject: [PATCH] Fix: PHP 8.3 compatibility for IP validation in Validation class - Updated `_validation_valid_ip` method to ensure compatibility with PHP 8.3. - Changed default `$flag` parameter value to an empty string (`''`) to prevent errors. - Added default case in `switch` to handle empty `$flag`, assigning `0` to ensure backward compatibility. Signed-off-by: Koji NAKAMURA --- classes/validation.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/classes/validation.php b/classes/validation.php index 4fd76ff38..c14f6625e 100644 --- a/classes/validation.php +++ b/classes/validation.php @@ -887,7 +887,7 @@ public function _validation_valid_url($val) * @param string ipv4|ipv6 * @return bool */ - public function _validation_valid_ip($val, $flag = null) + public function _validation_valid_ip($val, $flag = '') { switch (strtolower($flag)) { @@ -897,6 +897,9 @@ public function _validation_valid_ip($val, $flag = null) case 'ipv6': $flag = FILTER_FLAG_IPV6; break; + default: + $flag = 0; + break; } return $this->_empty($val) || filter_var($val, FILTER_VALIDATE_IP, $flag);