Skip to content

Commit

Permalink
Close #5918: PHP Fatal error debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
Miraeld committed Nov 21, 2023
1 parent cfc26a3 commit 6c9dc8e
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions views/cache/advanced-cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ function ( $class ) use ( $rocket_path ) { // phpcs:ignore Universal.NamingConve
$rocket_path . 'inc/classes/logger/class-stream-handler.php',
],
'WP_Rocket\\Traits\\Memoize' => [ $rocket_path . 'inc/classes/traits/trait-memoize.php' ],
'WP_Rocket\\Dependencies\\Psr\\Log' => [
$rocket_path . 'inc/Dependencies/Psr/Log/' . str_replace( '\\', '/', $class ) . '.php',
$rocket_path . 'vendor/psr/log/src/' . str_replace('\\', '/', $class) . '.php',
],
'WP_Rocket\\Dependencies\\Monolog' => [
$rocket_path . 'inc/Dependencies/Monolog/' . str_replace( '\\', '/', $class ) . '.php',
$rocket_path . 'vendor/monolog/monolog/src/' . str_replace( '\\', '/', $class ) . '.php',
],
];

if ( isset( $rocket_classes[ $class ] ) ) {
Expand All @@ -60,20 +68,6 @@ function ( $class ) use ( $rocket_path ) { // phpcs:ignore Universal.NamingConve
break;
}
}
} elseif ( strpos( $class, 'WP_Rocket\\Dependencies\\Monolog\\' ) === 0 ) {
$class = str_replace( 'WP_Rocket\\Dependencies\\Monolog\\', '', $class );

$file = $rocket_path . 'inc/Dependencies/Monolog/' . str_replace( '\\', '/', $class ) . '.php';
if ( ! file_exists( $file ) ) {
$file = $rocket_path . 'vendor/monolog/monolog/src/' . str_replace( '\\', '/', $class ) . '.php';
}
} elseif ( strpos( $class, 'WP_Rocket\\Dependencies\\Psr\\Log\\' ) === 0 ) {
$class = str_replace( 'WP_Rocket\\Dependencies\\Psr\\Log\\', '', $class );

$file = $rocket_path . 'inc/Dependencies/Psr/Log/' . str_replace( '\\', '/', $class ) . '.php';
if ( ! file_exists( $file ) ) {
$file = $rocket_path . 'vendor/psr/log/' . str_replace( '\\', '/', $class ) . '.php';
}
} else {
return;
}
Expand Down

0 comments on commit 6c9dc8e

Please sign in to comment.