From 7530ba893fd038b470d935d296ea0c4a521dd3cf Mon Sep 17 00:00:00 2001 From: jrfnl Date: Thu, 30 Nov 2023 15:35:53 +0100 Subject: [PATCH] Autoload: minor defensive coding --- phpunitpolyfills-autoload.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpunitpolyfills-autoload.php b/phpunitpolyfills-autoload.php index ab03f4d..ca96107 100644 --- a/phpunitpolyfills-autoload.php +++ b/phpunitpolyfills-autoload.php @@ -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; } @@ -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; }