Support » Plugin: Wordfence Security - Firewall, Malware Scan, and Login Security » Scan fails – Deprecated: Return type of Requests_Cookie_Jar::offsetExists($key)

  • Resolved germanfred


    Attempting to run a scan fails with the following error:

    Deprecated: Return type of Requests_Cookie_Jar::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

Viewing 15 replies - 1 through 15 (of 18 total)
  • Plugin Support wfpeter


    Hi @germanfred, thanks for reaching out to us.

    That’s a message from part of WordPress core that we use, and seems to occur in PHP 8.1 and/or 8.0. WordPress actually doesn’t seem to have addressed this as of version 5.9, so hopefully it’ll be updated in an upcoming version to suppress this notice.

    Deprecation notices are PHP highlighting that a feature that presently works will cease to work in a future PHP version, so despite this message there is no cause for concern at this time. You could raise it with WordPress to see if it’s on their roadmap for an update in the near future if you wish.



    I have the same notice: Deprecated: Return type of Requests_Cookie_Jar::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice.
    Reverted back to PHP 7.4 from PHP 8.1, message disappeared. But the WordFence plug-in still does not scan any files. But that’s a different issue.
    [May 25 22:25:26] Scan Complete. Scanned 0 files, 14 plugins, 3 themes…………

    Plugin Support wfpeter


    Hi @torgjoha,

    Also keep an eye on the release notes for WordPress for this potentially being resolved in upcoming releases. However, if you have another issue regarding scans and are a Wordfence Free customer, please start a new topic about this and we’ll be glad to help you out. Topics here concentrate on issues for the original topic starter so that resolutions can be simple to track.





    I see your comment around this being a WP Core issue and just a deprecation warning, but it’s stopping WF scans from completing as they keep failing at this point.

    Is WF not able to escalate this to WP as WF is not working correctly for us with this bug and all scan attempts fail?



    PHP 8.0.1
    WordPress 6.0.3
    FIX: wp-includes/Requests

    function…(mixed $key, mixed $value): void

    You can continue this
    include modifiers in functions


    Just upgraded two of my WP sites to PHP8.1 and indeed the only plugin which seems to fail completely is Wordfence.

    Is there a solution?

    • This reply was modified 4 months, 1 week ago by MarcelC.
    Andrew M


    Same as above – fails after this message



    Works after downgrading to PHP 8.0, deprecation-messages only with PHP 8.1. Fixed with updated code for the Requests-component in WordPress-core a few days ago – expected to be released with WordPress 6.2 then.

    speedpartner, thanks for tips. Downgrading to PHP 8.0 helped WP v6.1.1



    I can’t downgrade PHP in my new (free) MAMP version. What to do?

    I am having the same thing happen with Wordfence. I just asked Dreamhost to upgrade my php version to 8.1. Now I guess I will ask if they can downgrade me to 8.0 to see if it will work.

    • This reply was modified 1 month, 3 weeks ago by elfstacy.

    For all those saying the scan is failing, click on the Show Log link. You’ll see that the PHP notice is just the last text outputed and the previous lines indicate the scan completed. At least that’s what I’m seeing.

    Problem Research

    implements ArrayAccess crypto/vendor/paragonie/sodium_compat/src/Core/ChaCha20/Ctx.php crypto/vendor/paragonie/sodium_compat/src/Core/Curve25519/Fe.php crypto/vendor/paragonie/sodium_compat/src/Core32/ChaCha20/Ctx.php crypto/vendor/paragonie/sodium_compat/src/Core32/Curve25519/Fe.php crypto/vendor/paragonie/sodium_compat/src/PHP52/SplFixedArray.php

    The problem is much bigger

    WP update won’t help

    the solution to the problem lies entirely with the developers of the Wordfence plugin

    The plugin uses the paragonie/sodium_compat cryptographic library

    which in turn uses the PHP libraries etc.

    PHP 8.1 deprecates these classes if they do not contain typed arguments public offsetExists(mixed $offset): bool


    – update syntax (not a good idea)

    – wait for the paragonie/sodium_compat library code to be updated (this may not happen)

    – wait for the Wordfence plugin update (maybe the developers will solve the problem)

    – disable deprecated output (worth a try)

    PHP: error_reporting(E_ALL & ~E_DEPRECATED)

    php.ini: error_reporting = E_ALL & ~E_DEPRECATED

    Okay please fix this issue its bloating my error logs every day

    We are also getting this message in our logs. I didn’t think much of it at first, but…

    I’m not sure if it’s related, but every time WF scans and we receive the Cookie_Jar message, a few minutes after our Apache error logs say “(70007)The timeout specified has expired: AH01075: Error dispatching request to : (polling)”. This causes our entire server to go down and not come back until we restart it. This has only happened after WordFence attempts to scan our site.

    We are on PHP 8.1 and our memory_limit in php.ini is set to 512M. Increasing that directive was suggested in other posts I’ve read in an attempt to solve, but I’m wondering if the WF team has any insight or experience with this issue?

Viewing 15 replies - 1 through 15 (of 18 total)
  • You must be logged in to reply to this topic.