From: Mark A. Hershberger Date: Sun, 20 May 2018 14:51:34 +0000 (-0400) Subject: Don't require trailing slash in PSR-4 autoloader directory X-Git-Tag: 1.31.0-rc.1~5 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=8539ecb93dd7beaa4c422859baf233f0478f00d9 Don't require trailing slash in PSR-4 autoloader directory This avoids the confusing error “Fatal error: Uncaught InvalidArgumentException” or similar. Bug: T195211 Change-Id: Ifda59a26f8bd968a2d0acbdb157d81dc0bf6aab4 (cherry picked from commit 3b85e362a4098832a08529adc89571a86bf6e9a2) --- diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php index 52410fede8..6e7705653f 100644 --- a/includes/AutoLoader.php +++ b/includes/AutoLoader.php @@ -82,7 +82,7 @@ class AutoLoader { if ( isset( self::$psr4Namespaces[$prefix] ) ) { $relativeClass = substr( $className, $pos + 1 ); // Build the expected filename, and see if it exists - $file = self::$psr4Namespaces[$prefix] . + $file = self::$psr4Namespaces[$prefix] . '/' . str_replace( '\\', '/', $relativeClass ) . '.php'; if ( file_exists( $file ) ) { $filename = $file;