chronoforms Version 8.0.23
PHP 8.2
I got this error which filled a nice 1gb error log over few months.
PHP Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /public_html/plugins/content/chronoforms8/chronoforms8.php on line 22
here is the fix to the core file listed here above ⇧ and one more error coming right after, due to lack of checks of article text and in cases of loading the form in using the plugin {chronoforms 8}formName{/chronoforms8}
search these lines:
// Simple performance check to determine whether bot should process further
if (strpos($article->text, '{chronoforms8}') === false) {
return;
}
preg_match_all('#{chronoforms8}(.*?){/chronoforms8}#s', $article->text, $matches);
replace with this
// Simple performance check to determine whether bot should process further
// php 8.2 deprecated fixes
if (isset($article->text) && is_string($article->text) && strpos($article->text, '{chronoforms8}') === false) {
return;
}
if (!empty($article->text) && is_string($article->text)) {
preg_match_all('#{chronoforms8}(.*?){/chronoforms8}#s', $article->text, $matches);
}