• titsmaker

    (@titsmaker)


    Hi, I’ve just started testing WP with recently released PHP 8.1 and found that your plugin throws the following deprecation notices:

    PHP Deprecated: Return type of FS_Key_Value_Storage::offsetExists($k) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in \wp-content\plugins\error-log-monitor\freemius\includes\managers\class-fs-key-value-storage.php on line 309
    PHP Deprecated: Return type of FS_Key_Value_Storage::offsetGet($k) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in \wp-content\plugins\error-log-monitor\freemius\includes\managers\class-fs-key-value-storage.php on line 317
    PHP Deprecated: Return type of FS_Key_Value_Storage::offsetSet($k, $v) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in \wp-content\plugins\error-log-monitor\freemius\includes\managers\class-fs-key-value-storage.php on line 301
    PHP Deprecated: Return type of FS_Key_Value_Storage::offsetUnset($k) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in \wp-content\plugins\error-log-monitor\freemius\includes\managers\class-fs-key-value-storage.php on line 313
    PHP Deprecated: Return type of FS_Key_Value_Storage::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in \wp-content\plugins\error-log-monitor\freemius\includes\managers\class-fs-key-value-storage.php on line 328
    PHP Deprecated: Return type of FS_Key_Value_Storage::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in \wp-content\plugins\error-log-monitor\freemius\includes\managers\class-fs-key-value-storage.php on line 339
    PHP Deprecated: Return type of FS_Key_Value_Storage::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in \wp-content\plugins\error-log-monitor\freemius\includes\managers\class-fs-key-value-storage.php on line 350
    PHP Deprecated: Return type of FS_Key_Value_Storage::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in \wp-content\plugins\error-log-monitor\freemius\includes\managers\class-fs-key-value-storage.php on line 362
    PHP Deprecated: Return type of FS_Key_Value_Storage::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in \wp-content\plugins\error-log-monitor\freemius\includes\managers\class-fs-key-value-storage.php on line 375
    PHP Deprecated: Return type of FS_Key_Value_Storage::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in \wp-content\plugins\error-log-monitor\freemius\includes\managers\class-fs-key-value-storage.php on line 389
    PHP Deprecated: Return type of Elm_LogFilter::rewind() should either be compatible with FilterIterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in C:\Programs\laragon\www\artitest\wp-content\plugins\error-log-monitor\Elm\LogFilter.php on line 6
    PHP Deprecated: Return type of Elm_SeverityFilter::accept() should either be compatible with FilterIterator::accept(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in \wp-content\plugins\error-log-monitor\Elm\SeverityFilter.php on line 134

    These are only deprecations and wide usage of PHP 8.1 will start only in a few months, but it would be very kind of you to replace related code proactively.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Janis Elsts

    (@whiteshadow)

    Thank you for the report. It looks like I might need to increase the minimum requirements to at least PHP 7.0 to fix those notices, but about 8% of WordPress users are still on PHP 5.6. I’m not sure if this is the right time for that change.

    Thread Starter titsmaker

    (@titsmaker)

    Thanks for investigating, I got your point.
    I think upgrading the minimum PHP version of WordPress is long overdue. The related discussion in 2020 showed how democratic is WP – everybody wanted to drop PHP 5.6 support then Mr. Mullenweg appeared and said it was too early and that was it, end of discussion.
    I understand that updating PHP minimum before WordPress does it does not make sense for you. I hope it will happen in 2022.

    Plugin Author Janis Elsts

    (@whiteshadow)

    In theory, I’m not opposed to updating the requirements before WordPress does. What I’m concerned about are the actual PHP usage statistics. If less than 5% of sites were running older PHP versions, I could probably just change the requirements.

    Of course, in practice, those two things are connected – some users probably won’t upgrade until WordPress requires it.

    The cutoff is going to be PHP8.

    https://wiki.php.net/rfc/internal_method_return_types

    Unfortunately, union return types impose a compatibility challenge for libraries: as this construct is only supported since PHP 8.0, libraries would have to accept the fact by default that their code triggers E_DEPRECATED notices on PHP 8.1 if they also want to support PHP versions below 8.0. As a remedy, this RFC proposes to add a ReturnTypeWillChange attribute which could be used to suppress the related E_DEPRECATED notices. Thanks to the backward compatible syntax of attributes, this can be done in code which is compatible with PHP 7 and below.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Deprecation notices on PHP 8.1’ is closed to new replies.