|
21 | 21 | use CodeIgniter\HTTP\ResponseInterface; |
22 | 22 | use Config\Exceptions as ExceptionsConfig; |
23 | 23 | use ErrorException; |
24 | | -use Psr\Log\LogLevel; |
25 | 24 | use Throwable; |
26 | 25 |
|
27 | 26 | /** |
@@ -141,8 +140,8 @@ public function resetForWorkerMode(): void |
141 | 140 | public function errorHandler(int $severity, string $message, ?string $file = null, ?int $line = null) |
142 | 141 | { |
143 | 142 | if ($this->isDeprecationError($severity)) { |
144 | | - if ($this->isSessionSidDeprecationError($message, $file, $line)) { |
145 | | - return true; |
| 143 | + if ($this->isSessionSidDeprecationError($message) || $this->isSplObjectHashDeprecationError($message, $file)) { |
| 144 | + return $this->handleDeprecationError($message, $file, $line); |
146 | 145 | } |
147 | 146 |
|
148 | 147 | if (! $this->config->logDeprecations || (bool) env('CODEIGNITER_SCREAM_DEPRECATIONS')) { |
@@ -188,25 +187,28 @@ public function shutdownHandler() |
188 | 187 | } |
189 | 188 |
|
190 | 189 | /** |
191 | | - * Handles session.sid_length and session.sid_bits_per_character deprecations in PHP 8.4. |
| 190 | + * Detects the `session.sid_length` and `session.sid_bits_per_character` deprecations in PHP 8.4. |
192 | 191 | */ |
193 | | - private function isSessionSidDeprecationError(string $message, ?string $file = null, ?int $line = null): bool |
| 192 | + private function isSessionSidDeprecationError(string $message): bool |
194 | 193 | { |
195 | | - if (PHP_VERSION_ID >= 80400 && str_contains($message, 'session.sid_')) { |
196 | | - log_message( |
197 | | - LogLevel::WARNING, |
198 | | - '[DEPRECATED] {message} in {errFile} on line {errLine}.', |
199 | | - [ |
200 | | - 'message' => $message, |
201 | | - 'errFile' => clean_path($file ?? ''), |
202 | | - 'errLine' => $line ?? 0, |
203 | | - ], |
204 | | - ); |
205 | | - |
206 | | - return true; |
| 194 | + return PHP_VERSION_ID >= 80400 && str_contains($message, 'session.sid_'); |
| 195 | + } |
| 196 | + |
| 197 | + /** |
| 198 | + * Detects the `spl_object_hash()` deprecation in PHP 8.6 raised by `mikey179/vfsstream` and `kint-php/kint`. |
| 199 | + */ |
| 200 | + private function isSplObjectHashDeprecationError(string $message, ?string $file = null): bool |
| 201 | + { |
| 202 | + if (! str_contains($message, 'spl_object_hash()')) { |
| 203 | + return false; |
207 | 204 | } |
208 | 205 |
|
209 | | - return false; |
| 206 | + $file = str_replace('\\', '/', $file ?? ''); |
| 207 | + |
| 208 | + return str_contains($file, '/mikey179/vfsstream/') |
| 209 | + // @todo 4.8.0 Remove these checks once Kint v7 is released |
| 210 | + || str_contains($file, '/kint-php/kint/') |
| 211 | + || str_contains($file, '/system/ThirdParty/Kint/'); |
210 | 212 | } |
211 | 213 |
|
212 | 214 | /** |
|
0 commit comments