• Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /../wp-content/plugins/backwpup/inc/class-option.php on line 328

    wp 6.1.1

    php 8.1

Viewing 12 replies - 1 through 12 (of 12 total)
  • same problem, no back-up possible since PHP 8.1.

    I did my backup today and there were no warnings. However there were dozens of log entries, all starting with the “Deprecated: Return type of Requests_ (a long descriptive string here)” statement. I had changed from PHP 8 to 8.1 several days ago at the recommendation of my web host. I’m wondering if that is the cause of all these log entries.

    I’m seeing the same deprecation errors in my logs since upgrading to 8.1 (not my choice, IONOS is threatening to charge me extra if I stay on 7.4).

    I’m seeing this:

    [01-Feb-2023 02:03:31] Database backup done!
    [01-Feb-2023 02:03:31] Restart after 9 seconds.
    [01-Feb-2023 02:03:31] 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
    [01-Feb-2023 02:03:31] DEPRECATED: Return type of Requests_Cookie_Jar::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
    [01-Feb-2023 02:03:31] DEPRECATED: Return type of Requests_Cookie_Jar::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
    [01-Feb-2023 02:03:31] DEPRECATED: Return type of Requests_Cookie_Jar::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
    [01-Feb-2023 02:03:32] DEPRECATED: Return type of Requests_Cookie_Jar::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
    [01-Feb-2023 02:03:32] 1. Trying to make a list of folders to back up …
    [01-Feb-2023 02:03:33] DEPRECATED: Return type of Requests_Utility_CaseInsensitiveDictionary::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
    [01-Feb-2023 02:03:33] DEPRECATED: Return type of Requests_Utility_CaseInsensitiveDictionary::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
    [01-Feb-2023 02:03:33] DEPRECATED: Return type of Requests_Utility_CaseInsensitiveDictionary::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
    [01-Feb-2023 02:03:33] DEPRECATED: Return type of Requests_Utility_CaseInsensitiveDictionary::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
    [01-Feb-2023 02:03:33] DEPRECATED: Return type of Requests_Utility_CaseInsensitiveDictionary::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
    [01-Feb-2023 02:03:33] Added "wp-config.php" to backup file list
    [01-Feb-2023 02:03:33] 587 folders to backup.
    

    And after that everything goes OK until there’s a restart when I get this…

    [01-Feb-2023 02:04:30] Restart after 58 seconds.
    [01-Feb-2023 02:04:30] 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
    [01-Feb-2023 02:04:30] DEPRECATED: Return type of Requests_Cookie_Jar::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
    [01-Feb-2023 02:04:30] DEPRECATED: Return type of Requests_Cookie_Jar::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
    [01-Feb-2023 02:04:30] DEPRECATED: Return type of Requests_Cookie_Jar::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
    [01-Feb-2023 02:04:30] DEPRECATED: Return type of Requests_Cookie_Jar::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
    [01-Feb-2023 02:04:31] DEPRECATED: Return type of Requests_Utility_CaseInsensitiveDictionary::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
    [01-Feb-2023 02:04:31] DEPRECATED: Return type of Requests_Utility_CaseInsensitiveDictionary::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
    [01-Feb-2023 02:04:31] DEPRECATED: Return type of Requests_Utility_CaseInsensitiveDictionary::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
    [01-Feb-2023 02:04:31] Archiving Folder: /homepages/0/d894882115/htdocs/clickandbuilds/HaylingU3A/wp-content/plugins/advanced-database-cleaner/images/
    [01-Feb-2023 02:04:31] DEPRECATED: Return type of Requests_Utility_CaseInsensitiveDictionary::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
    [01-Feb-2023 02:04:31] DEPRECATED: Return type of Requests_Utility_CaseInsensitiveDictionary::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
    [01-Feb-2023 02:04:32] Archiving Folder: 

    The warnings repeat after every restart. Finally, I see this at the end…

    [01-Feb-2023 11:01:37] Job done in 633 seconds.
    [01-Feb-2023 11:01:37] DEPRECATED: Return type of Requests_Utility_CaseInsensitiveDictionary::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
    [01-Feb-2023 11:01:37] DEPRECATED: Return type of Requests_Utility_CaseInsensitiveDictionary::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
    [01-Feb-2023 11:01:37] DEPRECATED: Return type of Requests_Utility_CaseInsensitiveDictionary::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
    [01-Feb-2023 11:01:37] DEPRECATED: Return type of Requests_Utility_CaseInsensitiveDictionary::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

    I hope that helps,

    Andy

    I explored further and discovered that the log errors I’m seeing are WordPress bugs. Adding:

    #[\ReturnTypeWillChange]

    immediately before the definitions of functions:

    • offsetExists
    • offseGet
    • offetSet
    • offsetUnset
    • getIterator

    In:

    • wp-includes/Requests/Utility/CaseInsensitiveDictionary.php
    • wp-includes/Requests/Cookie/Jar.php

    Stopped the errors appearing. I’ll raise an issue against WordPress.

    My apologies to sahro and René for hijacking your topic.

    FWIW, you can prevent the trim() deprecation by editing line 328 in /wp-content/plugins/backwpup/inc/class-option.php from:

    $key = sanitize_key(trim($key));

    to

    if (!empty($key)) $key = sanitize_key(trim($key));

    My log looks essentially identical to the Andy H. log. Thank you Andy for figuring out a solution. Hopefully the WordPress folks will respond to this with a code fix. As a “non-coder” type, I’m reluctant to make these changes myself. Of course, I could back up the required files so if things go south on me, I could restore them to the originals. 🙂

    • This reply was modified 1 year, 5 months ago by ElsieBlogger.

    I checked and there’s quite a few WP classes (including the two noted above) with the same error already in the trac system and (hopefully) due for a fix in v6.2 (if not earlier).

    It is reasonably safe to ignore the warning but I reduced the execution time on my backups just in case the overhead of handling the issues causes another issue.

    Bonjour

    j’ai le même problème impossible de faire les mises à jour du coup quelle est la solution?

    Déprécié : version_compare() : Passer null au paramètre #2 ($version2) de type string est déprécié dans /homepages/25/d881719743/htdocs/clickandbuilds/ChezLibellule/wp-content/plugins/astra-addon/class-brainstorm-update -astra-addon.php à la ligne 219
    “\t\t

    \n\t\t\tStatistiques\t\t\tLes 30 derniers jours<\/span

    chezlibellule:

    Sorry to reply in English.

    From what I can see, your problem is entirely different to those described above and nothing to do with either BackWpUp or WordPress. Instead it seems your Astra theme has code that will fail in a future version of PHP. It is therefore being reported as a deprecation error.

    Normally deprecation errors don’t stop a site from working. However it looks like your setup might be displaying errors to the page. If so, that is not a good idea. The messages disrupt your pages and cause the ‘headers already sent’ message you are seeing.

    Andy

    It seems that this deprecation issue goes even deeper than BackWPup. I came across this on the WordPress site explaining some of what’s going on with PHP 8.0 and 8.1. It seems that not even WordPress is fully compatible with these later PHP versions. At least they claim that these deprecation statements aren’t errors (at least not yet). Hopefully the next WordPress release of 6.2 will have all (or most) of these issues resolved. But I don’t know if that helps BackWPup with its problem with 8.1.

    WordPress 5.9 and PHP 8.0-8.1

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘PHP 8.1 warning message’ is closed to new replies.