Don't require trailing slash in PSR-4 autoloader directory
authorMark A. Hershberger <mah@nichework.com>
Sun, 20 May 2018 14:51:34 +0000 (10:51 -0400)
committerLegoktm <legoktm@member.fsf.org>
Sun, 20 May 2018 19:48:40 +0000 (19:48 +0000)
This avoids the confusing error â€śFatal error: Uncaught
InvalidArgumentException” or similar.

Bug: T195211
Change-Id: Ifda59a26f8bd968a2d0acbdb157d81dc0bf6aab4
(cherry picked from commit 3b85e362a4098832a08529adc89571a86bf6e9a2)

includes/AutoLoader.php

index 52410fe..6e77056 100644 (file)
@@ -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
                                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;
                                                str_replace( '\\', '/', $relativeClass ) . '.php';
                                        if ( file_exists( $file ) ) {
                                                $filename = $file;