| @@ -288,8 +288,13 @@ | ||
| 288 | 288 | |
| 289 | 289 | $file = $this->normalize_path( $dir . $filename ); |
| 290 | 290 | |
| 291 | 291 | $stat = @stat( $file ); |
| 292 | + if ( false === $stat || ! isset( $stat['mtime'] ) ) { | |
| 293 | + // A concurrent CAPTCHA cleanup can remove the file after readdir(). | |
| 294 | + continue; | |
| 295 | + } | |
| 296 | + | |
| 292 | 297 | if ( ( $stat['mtime'] + $minutes * 60 ) < time() ) { |
| 293 | 298 | // phpcs:ignore WordPress.WP.AlternativeFunctions.unlink_unlink |
| 294 | 299 | if ( ! @wp_delete_file( $file ) ) { |
| 295 | 300 | // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_chmod |
| @@ -424,5 +429,5 @@ | ||
| 424 | 429 | $path = str_replace( '\\', '/', $path ); |
| 425 | 430 | $path = preg_replace( '|/+|', '/', $path ); |
| 426 | 431 | return $path; |
| 427 | 432 | } |
| 428 | -} | |
| 433 | +} | |