• I get deprecation warnings like this on my server running PHP 8.5:

    Deprecated: Function curl_close() is deprecated since 8.5, as it has no effect since PHP 8.0 in /var/www/myserver/wp-content/plugins/cleantalk-spam-protect/lib/Cleantalk/Common/HTTP/Request.php on line 230

    Suggested solution: remove any call of curl_close(). It it is not needed. And if you still want to support older PHP versions, only call it when the reported PHP version is older than 8.0:

        /**
    * @return Response
    */
    protected function requestSingle()
    {

    ...
    if (PHP_VERSION_ID < 80000) {
    curl_close($ch);
    }
    • This topic was modified 2 days, 8 hours ago by Arno Welzel. Reason: Added suggestion for the fix
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support denisxam

    (@denisxam)

    Hello.
    Please follow these steps:

    • Clear all cache on your site.
    • Deactivate the CleanTalk plugin with the Complete Deactivation option:
      WordPress Admin Page – Settings – Anti-Spam by CleanTalk – Advanced Settings – enable “Complete Deactivation” – Save Changes.

    • Plugins – Installed plugins – Anti-Spam by CleanTalk – Deactivate and Activate

    This option will reset all plugin settings. Don’t forget to insert your access key.
    https://cleantalk.org/help/access-key

    Please let me know if this helped?
    Best Regards,

    Thread Starter Arno Welzel

    (@awelzel)

    No, this will not change anything, since it is caused by a call in your code.

    Please see here: https://plugins.svn.wordpress.org/cleantalk-spam-protect/tags/6.82/lib/Cleantalk/Common/HTTP/Request.php

        /**
    * @return Response
    */
    protected function requestSingle()
    {
    // Make a request
    $ch = curl_init();

    curl_setopt_array($ch, $this->options);

    $request_result = curl_exec($ch); // Gather request result
    $curl_info = curl_getinfo($ch); // Gather HTTP response information

    // Do not catch timeout error for async requests.
    if ( in_array('async', $this->presets, true) ) {
    $request_result = true;
    }

    if ( $request_result === false ) {
    $request_result = array('error' => curl_error($ch));
    }

    curl_close($ch);


    return new Response($request_result, $curl_info);
    }

    Since PHP 8.0 curl_close() is no longer needed and since PHP 8.5 it is deprecated and should not be used any longer. Also see: https://www.php.net/manual/en/function.curl-close.php, Quote:

    Warning This function has been DEPRECATED as of PHP 8.5.0. Relying on this function is highly discouraged.

    Even the latest tag https://plugins.svn.wordpress.org/cleantalk-spam-protect/tags/6.9.2/lib/Cleantalk/Common/HTTP/Request.php still contains the same call. Please remove that call or do a version check for PHP 8.0 or newer, before using that call, as I suggested.

    • This reply was modified 1 day, 17 hours ago by Arno Welzel.
    Plugin Support denisxam

    (@denisxam)

    Hello,

    I’ve forwarded the information to our developers. We will respond to you within 3 business days.

    Best Regards,

    Plugin Support sergecleantalk

    (@sergecleantalk)

    Hello,

    You can install the newest release version that includes fixes:

    https://downloads.wordpress.org/plugin/cleantalk-spam-protect.6.83.zip

    • Go to the WordPress Administrator Panel -> Plugins.
    • Find the plugin ‘Anti-Spam by CleanTalk’ -> Deactivate.
    • After the automatic page refreshing, find the plugin again ‘Anti-Spam by CleanTalk’ -> Delete. Confirm files deletion.
    • Download the plugin archive from the link.
    • Go to Plugins -> Add New -> Upload Plugin.
    • Choose the downloaded archive and press ‘Install Now’.
    • Once you have installed the plugin, activate it and check that the access key matches the one on your CleanTalk dashboard.

    This version will be widely available within 1-2 days.

    Did it help?

    Thread Starter Arno Welzel

    (@awelzel)

    Maybe your developers got that wrong. Yes, the warning will start in PHP 8.5. But even in PHP 8.0 using curl_close() makes no longer sense. Also see https://php.watch/versions/8.5/curl_close-curl_share_close-deprecated

    So please change this:

            if (PHP_VERSION_ID < 80500) {
    curl_close($ch);
    }

    To this:

           if (PHP_VERSION_ID < 80000) {
    curl_close($ch);
    } else {
    unset($ch);
    }

    Thank you!

    Plugin Support sergecleantalk

    (@sergecleantalk)

    Thank you for your reply. I will transfer this to our developers. We will contact you within 1-3 business days.

Viewing 6 replies - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.