Skip to content

Commit 8b034b8

Browse files
committed
feat: add deprecation error handling for session.sid_length and session.sid_bits_per_character
1 parent 7e58971 commit 8b034b8

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

system/Debug/Exceptions.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,10 @@ public function exceptionHandler(Throwable $exception)
209209
public function errorHandler(int $severity, string $message, ?string $file = null, ?int $line = null)
210210
{
211211
if ($this->isDeprecationError($severity)) {
212+
if ($this->isSessionSidDeprecationError($message, $file, $line)) {
213+
return true;
214+
}
215+
212216
if (! $this->config->logDeprecations || (bool) env('CODEIGNITER_SCREAM_DEPRECATIONS')) {
213217
throw new ErrorException($message, 0, $severity, $file, $line);
214218
}
@@ -223,6 +227,32 @@ public function errorHandler(int $severity, string $message, ?string $file = nul
223227
return false; // return false to propagate the error to PHP standard error handler
224228
}
225229

230+
/**
231+
* Handles session.sid_length and session.sid_bits_per_character deprecations
232+
* in PHP 8.4.
233+
*/
234+
private function isSessionSidDeprecationError(string $message, ?string $file = null, ?int $line = null): bool
235+
{
236+
if (
237+
PHP_VERSION_ID >= 80400
238+
&& str_contains($message, 'session.sid_')
239+
) {
240+
log_message(
241+
LogLevel::WARNING,
242+
'[DEPRECATED] {message} in {errFile} on line {errLine}.',
243+
[
244+
'message' => $message,
245+
'errFile' => clean_path($file ?? ''),
246+
'errLine' => $line ?? 0,
247+
]
248+
);
249+
250+
return true;
251+
}
252+
253+
return false;
254+
}
255+
226256
/**
227257
* Checks to see if any errors have happened during shutdown that
228258
* need to be caught and handle them.

0 commit comments

Comments
 (0)