From db719245afe375df1d6c406b017af530b746c192 Mon Sep 17 00:00:00 2001 From: Fraenkiman Date: Sat, 6 Jan 2024 15:09:05 +0100 Subject: [PATCH] no transfer of null to parameter of type string - Fixes: Passing null to parameter #1 ($string) of type string is deprecated --- .../validate_criteria.isEmail.php | 15 +++++++-------- .../fp-smartyplugins/validate_criteria.isURL.php | 11 +++++++---- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/fp-includes/fp-smartyplugins/validate_criteria.isEmail.php b/fp-includes/fp-smartyplugins/validate_criteria.isEmail.php index 3b8826a..a112998 100644 --- a/fp-includes/fp-smartyplugins/validate_criteria.isEmail.php +++ b/fp-includes/fp-smartyplugins/validate_criteria.isEmail.php @@ -28,16 +28,15 @@ /** * test if a value is a valid e-mail address * - * @param string $value - * the value being tested - * @param boolean $empty - * if field can be empty - * @param - * array params validate parameter values - * @param - * array formvars form var values + * @param string $value the value being tested + * @param boolean $empty if field can be empty + * @param array params validate parameter values + * @param array formvars form var values */ function smarty_validate_criteria_isEmail($value, $empty, &$params, &$formvars) { + if (empty($value)) + return $empty; + if (strlen($value) == 0) return $empty; diff --git a/fp-includes/fp-smartyplugins/validate_criteria.isURL.php b/fp-includes/fp-smartyplugins/validate_criteria.isURL.php index 6424dbb..3b96690 100644 --- a/fp-includes/fp-smartyplugins/validate_criteria.isURL.php +++ b/fp-includes/fp-smartyplugins/validate_criteria.isURL.php @@ -35,11 +35,14 @@ * @param array formvars form var values */ function smarty_validate_criteria_isURL($value, $empty, &$params, &$formvars) { - if(strlen($value) == 0) - return $empty; + if (empty($value)) + return $empty; - return preg_match('!^http(s)?://[\w-]+\.[\w-]+(\S+)?$!i', $value) - || preg_match('!^http(s)?://localhost!', $value); + if(strlen($value) == 0) + return $empty; + + return preg_match('!^http(s)?://[\w-]+\.[\w-]+(\S+)?$!i', $value) + || preg_match('!^http(s)?://localhost!', $value); // quick and dirty hack: review --NoWhereMan }