@@ -213,6 +213,10 @@ public function errorHandler(int $severity, string $message, ?string $file = nul
213213 return true ;
214214 }
215215
216+ if ($ this ->isImplicitNullableDeprecationError ($ message , $ file , $ line )) {
217+ return true ;
218+ }
219+
216220 if (! $ this ->config ->logDeprecations || (bool ) env ('CODEIGNITER_SCREAM_DEPRECATIONS ' )) {
217221 throw new ErrorException ($ message , 0 , $ severity , $ file , $ line );
218222 }
@@ -253,6 +257,38 @@ private function isSessionSidDeprecationError(string $message, ?string $file = n
253257 return false ;
254258 }
255259
260+ /**
261+ * Workaround to implicit nullable deprecation errors in PHP 8.4.
262+ *
263+ * "Implicitly marking parameter $xxx as nullable is deprecated,
264+ * the explicit nullable type must be used instead"
265+ *
266+ * @TODO remove this before v4.6.0 release
267+ */
268+ private function isImplicitNullableDeprecationError (string $ message , ?string $ file = null , ?int $ line = null ): bool
269+ {
270+ if (
271+ PHP_VERSION_ID >= 80400
272+ && str_contains ($ message , 'the explicit nullable type must be used instead ' )
273+ // Only Kint and Faker, which cause this error, are logged.
274+ && (str_starts_with ($ message , 'Kint \\' ) || str_starts_with ($ message , 'Faker \\' ))
275+ ) {
276+ log_message (
277+ LogLevel::WARNING ,
278+ '[DEPRECATED] {message} in {errFile} on line {errLine}. ' ,
279+ [
280+ 'message ' => $ message ,
281+ 'errFile ' => clean_path ($ file ?? '' ),
282+ 'errLine ' => $ line ?? 0 ,
283+ ]
284+ );
285+
286+ return true ;
287+ }
288+
289+ return false ;
290+ }
291+
256292 /**
257293 * Checks to see if any errors have happened during shutdown that
258294 * need to be caught and handle them.
0 commit comments