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
Copy file name to clipboardExpand all lines: user_guide_src/source/general/errors.rst
+31-31Lines changed: 31 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -87,6 +87,37 @@ To ignore logging on other status codes, you can set the status code to ignore i
87
87
:ref:`Log settings <logging-configuration>`
88
88
are not set up to log ``critical`` errors, which all exceptions are logged as.
89
89
90
+
.. _logging_deprecation_warnings:
91
+
92
+
Logging Deprecation Warnings
93
+
----------------------------
94
+
95
+
.. versionadded:: 4.3.0
96
+
97
+
By default, all errors reported by ``error_reporting()`` will be thrown as an ``ErrorException`` object. These
98
+
include both ``E_DEPRECATED`` and ``E_USER_DEPRECATED`` errors. With the surge in use of PHP 8.1+, many users
99
+
may see exceptions thrown for `passing null to non-nullable arguments of internal functions <https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg>`_.
100
+
To ease the migration to PHP 8.1, you can instruct CodeIgniter to log the deprecations instead of throwing them.
101
+
102
+
First, make sure your copy of ``Config\Exceptions`` is updated with the two new properties and set as follows:
103
+
104
+
.. literalinclude:: errors/012.php
105
+
106
+
Next, depending on the log level you set in ``Config\Exceptions::$deprecationLogLevel``, check whether the
107
+
logger threshold defined in ``Config\Logger::$threshold`` covers the deprecation log level. If not, adjust
108
+
it accordingly.
109
+
110
+
.. literalinclude:: errors/013.php
111
+
112
+
After that, subsequent deprecations will be logged instead of thrown.
113
+
114
+
This feature also works with user deprecations:
115
+
116
+
.. literalinclude:: errors/014.php
117
+
118
+
For testing your application you may want to always throw on deprecations. You may configure this by
119
+
setting the environment variable ``CODEIGNITER_SCREAM_DEPRECATIONS`` to a truthy value.
120
+
90
121
Framework Exceptions
91
122
====================
92
123
@@ -197,37 +228,6 @@ Since v4.3.0, you can specify the exit code for your Exception class to implemen
197
228
198
229
When an exception implementing ``HasExitCodeInterface`` is caught by CodeIgniter's exception handler, the code returned from the ``getExitCode()`` method will become the exit code.
199
230
200
-
.. _logging_deprecation_warnings:
201
-
202
-
Logging Deprecation Warnings
203
-
============================
204
-
205
-
.. versionadded:: 4.3.0
206
-
207
-
By default, all errors reported by ``error_reporting()`` will be thrown as an ``ErrorException`` object. These
208
-
include both ``E_DEPRECATED`` and ``E_USER_DEPRECATED`` errors. With the surge in use of PHP 8.1+, many users
209
-
may see exceptions thrown for `passing null to non-nullable arguments of internal functions <https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg>`_.
210
-
To ease the migration to PHP 8.1, you can instruct CodeIgniter to log the deprecations instead of throwing them.
211
-
212
-
First, make sure your copy of ``Config\Exceptions`` is updated with the two new properties and set as follows:
213
-
214
-
.. literalinclude:: errors/012.php
215
-
216
-
Next, depending on the log level you set in ``Config\Exceptions::$deprecationLogLevel``, check whether the
217
-
logger threshold defined in ``Config\Logger::$threshold`` covers the deprecation log level. If not, adjust
218
-
it accordingly.
219
-
220
-
.. literalinclude:: errors/013.php
221
-
222
-
After that, subsequent deprecations will be logged instead of thrown.
223
-
224
-
This feature also works with user deprecations:
225
-
226
-
.. literalinclude:: errors/014.php
227
-
228
-
For testing your application you may want to always throw on deprecations. You may configure this by
229
-
setting the environment variable ``CODEIGNITER_SCREAM_DEPRECATIONS`` to a truthy value.
0 commit comments