• Resolved gchtr

    (@gchtr)


    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.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support eugenecleantalk

    (@eugenecleantalk)

    Hello @gchtr.

    Thanks for the detailed description. I passed the information to our developers. We will inform you about our decision within 3 business days.

    Plugin Author alexandergull

    (@alexandergull)

    Hello, @gchtr.

    The stripos() check consider arrays.

    The fatal error is already fixed in the fix version.

    https://github.com/CleanTalk/wordpress-antispam/commit/9003ddbe96d147adc1e0deeafce0f53f2dafdc61

    It would be great if FacetWP requests would always be ignored by default.

    Could you tell me if the facetwp_refresh is AJAX submission or regular POST data submission?

    To know the way is important for us to implement exclusion for these requests.

    Thread Starter gchtr

    (@gchtr)

    Thanks a lot for fixing this!

    Could you tell me if the?facetwp_refresh?is AJAX submission or regular POST data submission?

    It’s an AJAX request made using fetch() with POST method:

    fetch(endpoint, {
        method: 'POST',
        // ...
    }

    The endpoint can either be

    • the current URL of the page that is displayed
    • or a REST endpoint (e.g. /wp-json/facetwp/v1/refresh).

    Here you can see an example from the FacetWP demo: https://facetwp.com/demo/cars/.

    As far as I can see, no requests are made using admin-ajax.php.

    Plugin Support eugenecleantalk

    (@eugenecleantalk)

    Thank you. We will consider your suggestion and contact you within 5 business days.

    Plugin Author alexandergull

    (@alexandergull)

    @gchtr

    Could you try this version?

    I’ve tried to exclude the facetwp_refresh action from CleanTalk check.

    However, I have no opprotunity to install the paid version of the facetwp plugin, so the fix is based on my own presume how it should work.

    If there is no success with, I suggest you to contact us via the Ticket System, then we could talk about private details there.

    Plugin Support SergeM

    (@serge00)

    We haven’t received your reply in a few days, so I’m going to mark this topic as “resolved”.
    If you have any further questions, you can start a new topic anytime.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Fatal error in combination with form sign exclusions’ is closed to new replies.