From d85dc9ae43a0a3d7974c688b18cbb0a71a5c79b0 Mon Sep 17 00:00:00 2001 From: Fraenkiman Date: Fri, 29 Dec 2023 23:05:06 +0100 Subject: [PATCH 1/6] Fixes #294 - Fixes PHP Warning: Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated --- fp-plugins/bbcode/inc/stringparser.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fp-plugins/bbcode/inc/stringparser.class.php b/fp-plugins/bbcode/inc/stringparser.class.php index 2230b03..24a3ef9 100755 --- a/fp-plugins/bbcode/inc/stringparser.class.php +++ b/fp-plugins/bbcode/inc/stringparser.class.php @@ -296,6 +296,10 @@ class StringParser { return false; } $this->_parsing = true; + { + $text = $text ?? ''; // If the value passed into function is null set $text to a blank string + return htmlspecialchars($text, ENT_QUOTES, 'UTF-8', false); // Return escaped string + } $this->_text = $this->_applyPrefilters($text); $this->_output = null; $this->_length = strlen($this->_text); From a29052ba38eeb6fe8864efb92c6dfe6980db0550 Mon Sep 17 00:00:00 2001 From: Fraenkiman Date: Tue, 2 Jan 2024 17:56:28 +0100 Subject: [PATCH 2/6] Fixes #294 Fixes #294 --- .../fp-smartyplugins/validate_criteria.notEmpty.php | 8 ++++++-- fp-plugins/bbcode/inc/stringparser.class.php | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/fp-includes/fp-smartyplugins/validate_criteria.notEmpty.php b/fp-includes/fp-smartyplugins/validate_criteria.notEmpty.php index 0809cc0..ad80463 100644 --- a/fp-includes/fp-smartyplugins/validate_criteria.notEmpty.php +++ b/fp-includes/fp-smartyplugins/validate_criteria.notEmpty.php @@ -34,7 +34,11 @@ * @param array formvars form var values */ function smarty_validate_criteria_notEmpty($value, $empty, &$params, &$formvars) { - return strlen($value) > 0; +// Return a message if value is empty + if(empty($value)) { + echo "Smarty plugin: value is empty!"; + } else { + return strlen($value) > 0; + } } - ?> diff --git a/fp-plugins/bbcode/inc/stringparser.class.php b/fp-plugins/bbcode/inc/stringparser.class.php index 24a3ef9..1341924 100755 --- a/fp-plugins/bbcode/inc/stringparser.class.php +++ b/fp-plugins/bbcode/inc/stringparser.class.php @@ -302,6 +302,7 @@ class StringParser { } $this->_text = $this->_applyPrefilters($text); $this->_output = null; + $this->_text = $this->_text ?? ''; $this->_length = strlen($this->_text); $this->_cpos = 0; unset($this->_stack); From 9577b51aca6ca7559adae21d31f5652507165a41 Mon Sep 17 00:00:00 2001 From: Fraenkiman Date: Tue, 2 Jan 2024 18:28:46 +0100 Subject: [PATCH 3/6] Update stringparser.class.php --- fp-plugins/bbcode/inc/stringparser.class.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/fp-plugins/bbcode/inc/stringparser.class.php b/fp-plugins/bbcode/inc/stringparser.class.php index 1341924..81b0a18 100755 --- a/fp-plugins/bbcode/inc/stringparser.class.php +++ b/fp-plugins/bbcode/inc/stringparser.class.php @@ -296,10 +296,6 @@ class StringParser { return false; } $this->_parsing = true; - { - $text = $text ?? ''; // If the value passed into function is null set $text to a blank string - return htmlspecialchars($text, ENT_QUOTES, 'UTF-8', false); // Return escaped string - } $this->_text = $this->_applyPrefilters($text); $this->_output = null; $this->_text = $this->_text ?? ''; From 8c2d819fa2d22e2e52a9d87aede74bec3885f3ea Mon Sep 17 00:00:00 2001 From: Fraenkiman Date: Tue, 2 Jan 2024 18:54:54 +0100 Subject: [PATCH 4/6] Update validate_criteria.notEmpty.php --- fp-includes/fp-smartyplugins/validate_criteria.notEmpty.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fp-includes/fp-smartyplugins/validate_criteria.notEmpty.php b/fp-includes/fp-smartyplugins/validate_criteria.notEmpty.php index ad80463..02f55f0 100644 --- a/fp-includes/fp-smartyplugins/validate_criteria.notEmpty.php +++ b/fp-includes/fp-smartyplugins/validate_criteria.notEmpty.php @@ -36,7 +36,7 @@ function smarty_validate_criteria_notEmpty($value, $empty, &$params, &$formvars) { // Return a message if value is empty if(empty($value)) { - echo "Smarty plugin: value is empty!"; + echo "Smarty plugin: value is empty!\n"; } else { return strlen($value) > 0; } From 672f498cf663d7556e79f06e70cec7a0ebc77a51 Mon Sep 17 00:00:00 2001 From: Fraenkiman Date: Tue, 2 Jan 2024 19:16:34 +0100 Subject: [PATCH 5/6] Update validate_criteria.notEmpty.php --- fp-includes/fp-smartyplugins/validate_criteria.notEmpty.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fp-includes/fp-smartyplugins/validate_criteria.notEmpty.php b/fp-includes/fp-smartyplugins/validate_criteria.notEmpty.php index 02f55f0..2e9dfea 100644 --- a/fp-includes/fp-smartyplugins/validate_criteria.notEmpty.php +++ b/fp-includes/fp-smartyplugins/validate_criteria.notEmpty.php @@ -36,7 +36,7 @@ function smarty_validate_criteria_notEmpty($value, $empty, &$params, &$formvars) { // Return a message if value is empty if(empty($value)) { - echo "Smarty plugin: value is empty!\n"; + echo "Smarty plugin: value is empty or null!\n"; } else { return strlen($value) > 0; } From 4ce8fb3ea90cef6d4088f46abf057e7018c7039c Mon Sep 17 00:00:00 2001 From: Fraenkiman Date: Tue, 2 Jan 2024 20:13:02 +0100 Subject: [PATCH 6/6] Update validate_criteria.notEmpty.php --- .../fp-smartyplugins/validate_criteria.notEmpty.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/fp-includes/fp-smartyplugins/validate_criteria.notEmpty.php b/fp-includes/fp-smartyplugins/validate_criteria.notEmpty.php index 2e9dfea..2fd043a 100644 --- a/fp-includes/fp-smartyplugins/validate_criteria.notEmpty.php +++ b/fp-includes/fp-smartyplugins/validate_criteria.notEmpty.php @@ -34,10 +34,9 @@ * @param array formvars form var values */ function smarty_validate_criteria_notEmpty($value, $empty, &$params, &$formvars) { -// Return a message if value is empty - if(empty($value)) { - echo "Smarty plugin: value is empty or null!\n"; - } else { + if(empty($value)) { + return false; + } else { return strlen($value) > 0; } }