From c4587de53ebd0e3958103a0040d8c3b0545ce5bf Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Sun, 11 Aug 2013 15:17:28 +0200 Subject: [PATCH] Fixed autoloader behavior according to leading \ As of PHP 5.3.2 PHP does not send class names with leading \ to autoload functions. Removed ltrim for '/' from autoload because it is 1. not needed: https://bugs.php.net/bug.php?id=50731 and 2. possibly wrong behavior: https://bugs.php.net/bug.php?id=51087 --- framework/yii/YiiBase.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/framework/yii/YiiBase.php b/framework/yii/YiiBase.php index 4d94b5f..51b63e1 100644 --- a/framework/yii/YiiBase.php +++ b/framework/yii/YiiBase.php @@ -341,15 +341,13 @@ class YiiBase * 4. Search PHP include_path for the actual class file if [[enableIncludePath]] is true; * 5. Return false so that other autoloaders have chance to include the class file. * - * @param string $className class name + * @param string $className the fully qualified class name without leading \ * @return boolean whether the class has been loaded successfully * @throws InvalidConfigException if the class file does not exist * @throws UnknownClassException if the class does not exist in the class file */ public static function autoload($className) { - $className = ltrim($className, '\\'); - if (isset(self::$classMap[$className])) { $classFile = self::$classMap[$className]; if ($classFile[0] === '@') {