Fatal error in combination with form sign exclusions
-
I’m getting the same error as in https://www.ads-software.com/support/topic/fatal-error-4552/.
PHP Fatal error: Uncaught TypeError: stripos(): Argument #1 ($haystack) must be of type string, array given in wp-content/plugins/cleantalk-spam-protect/inc/cleantalk-common.php:467
We use the following text in the form sign exclusion setting of the plugin:
.*cleantalk_ignore_form+
When a form sign exclusion is set, then the
apbct_exclusions_check__form_signs()
kicks in. In this function, there’s the following check:stripos($haystack, $exclusion) !== false
The problem is that
$haystack
might be an array. In our case, it happens with the FacetWP plugin. Here’s an excerpt of$form_data
that is sent when FacetWP refreshes a filter view. As you can see,data
contains an array, and not just a single value:[ "action" => "facetwp_refresh", "data" => [ "facets" => [ "land" => [], "ambassador_kategorie" => [ 0 => "snowboard" ] ], "frozen_facets" => [], "http_params" => [ "get" => [ "_ambassador_kategorie" => "snowboard" ], "uri" => "ambassadors", "url_vars" => [] ], "template" => "wp", "extras" => [ "pager" => true, "sort" => "default" ], "soft_refresh" => 0, "is_bfcache" => 1, "first_load" => 0, "paged" => 1 ] ];
We fixed this particular error by updating the value in the form sign exclusion settings with the
facetwp_refresh
action..*cleantalk_ignore_form|facetwp_refresh+
So in summary, there’s two things that might be optimized:
- The
stripos()
check consider arrays. - It would be great if FacetWP requests would always be ignored by default.
- The
- The topic ‘Fatal error in combination with form sign exclusions’ is closed to new replies.