Skip to content

Commit

Permalink
Autoload: minor defensive coding
Browse files Browse the repository at this point in the history
  • Loading branch information
jrfnl committed Feb 23, 2024
1 parent f07cf7b commit 7530ba8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions phpunitpolyfills-autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static function load( $className ) {
if ( $className === 'Error' || $className === 'TypeError' ) {
$file = \realpath( __DIR__ . '/src/Exceptions/' . $className . '.php' );

if ( \file_exists( $file ) === true ) {
if ( \is_string( $file ) && \file_exists( $file ) === true ) {
require_once $file;
return true;
}
Expand Down Expand Up @@ -128,7 +128,7 @@ public static function load( $className ) {
default:
$file = \realpath( __DIR__ . '/src/' . \strtr( \substr( $className, 23 ), '\\', '/' ) . '.php' );

if ( \file_exists( $file ) === true ) {
if ( \is_string( $file ) && \file_exists( $file ) === true ) {
require_once $file;
return true;
}
Expand Down

0 comments on commit 7530ba8

Please sign in to comment.