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
The function deprecated is trigger_error with the error level of E_USER_NOTICE.
I argue this should be at least a E_USER_WARNING, if not even an E_USER_ERROR.
Similar arguments can be made for the other trigger_error in the same file.
Reason
We just found a bug from the Timber v2 migration, that could been easily caught, if the correct error level was used.
👉🏻 Code: term.posts(1, 'post_type')
[ Timber ] Passing post_type_or_class is deprecated since Timber version 2.0.0! Use Pass post_type as part of the $query argument. For specifying class, use Class Maps: https://timber.github.io/docs/v2/guides/class-maps/ instead.
I strongly suggest, to increase the error level for important messages like this to at least WARNING, if not even ERROR.
NOTICE is something, that is normally not displayed and not even logged because of the noise level.
Which means there is good chance this issue will not be noticed and you end up with another annoying bug, that is probably not easy to spot as the above code just ignores the post_type and returns a post.
NOTICE Run-time notices. Indicate that the script encountered something that could indicate an error, but could also happen in the normal course of running a script.
WARNING: Run-time warnings (non-fatal errors). Execution of the script is not halted.
ERROR: Fatal run-time errors. These indicate errors that can not be recovered from, such as a memory allocation problem. Execution of the script is halted.
The text was updated successfully, but these errors were encountered:
2.x Improve error handling
2.x Improve error handling #2196The function
deprecated
istrigger_error
with the error level ofE_USER_NOTICE
.I argue this should be at least a
E_USER_WARNING
, if not even anE_USER_ERROR
.Similar arguments can be made for the other
trigger_error
in the same file.Reason
We just found a bug from the Timber v2 migration, that could been easily caught, if the correct error level was used.
👉🏻 Code:
term.posts(1, 'post_type')
I strongly suggest, to increase the error level for important messages like this to at least
WARNING
, if not evenERROR
.NOTICE
is something, that is normally not displayed and not even logged because of the noise level.Which means there is good chance this issue will not be noticed and you end up with another annoying bug, that is probably not easy to spot as the above code just ignores the
post_type
and returns a post.As always, I'm happy to provide a PR.
Error Definition
https://www.php.net/manual/en/errorfunc.constants.php
NOTICE Run-time notices. Indicate that the script encountered something that could indicate an error, but could also happen in the normal course of running a script.
WARNING: Run-time warnings (non-fatal errors). Execution of the script is not halted.
ERROR: Fatal run-time errors. These indicate errors that can not be recovered from, such as a memory allocation problem. Execution of the script is halted.
The text was updated successfully, but these errors were encountered: