You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In many plugins, I have noticed an issue with the error control operator @ used with set_time_limit().
The error happens when PHP 8.0 is used and when set_time_limit() has been disabled on the server.
Prior to PHP 8.0.0, it was possible for the @ operator to disable critical errors that will terminate script execution. For example, prepending @ to a call of a function which did not exist, by being unavailable or mistyped, would cause the script to terminate with no indication as to why. https://www.php.net/manual/en/language.operators.errorcontrol.php
Describe the solution you'd like
I think the sniffs should look for the error operator and trigger a warning.
Additional context (optional)
PHP 8.0
any disabled function used with the error operator
The text was updated successfully, but these errors were encountered:
@benoitchantre It already does. The WordPress.PHP.NoSilencedErrors sniff does exactly that and is included in both the WordPress-Core as well as the WordPress-Extra rulesets.
For Core, the sniff respects a list of PHP native functions for which to allow the @ operator (which doesn't include the set_time_limit() function). For Extra that list is disregarded by default and a warning will be thrown for all uses of @.
Is your feature request related to a problem?
In many plugins, I have noticed an issue with the error control operator
@
used withset_time_limit()
.The error happens when PHP 8.0 is used and when
set_time_limit()
has been disabled on the server.Describe the solution you'd like
I think the sniffs should look for the error operator and trigger a warning.
Additional context (optional)
The text was updated successfully, but these errors were encountered: