From 8923e9d40a0dbc62f18be8294befb23c10aa5bfa Mon Sep 17 00:00:00 2001 From: Sascha Beining Date: Wed, 20 Feb 2019 14:52:35 +0100 Subject: [PATCH] Fix autoloading for locales with different lowercase rules MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The class map generation and the lookup should use a neutral locale to generate the lowercase classnames. Without this fix locales like turkish will not be able to load classes with an uppercase ā€žIā€œ for example. --- lib/autoload/sfCoreAutoload.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/autoload/sfCoreAutoload.class.php b/lib/autoload/sfCoreAutoload.class.php index d16a0310b..6694b35ad 100755 --- a/lib/autoload/sfCoreAutoload.class.php +++ b/lib/autoload/sfCoreAutoload.class.php @@ -116,7 +116,9 @@ public function autoload($class) */ public function getClassPath($class) { + $old = setlocale(LC_ALL, 'C'); $class = strtolower($class); + setlocale(LC_ALL, $old); if (!isset($this->classes[$class])) { @@ -169,7 +171,9 @@ static public function make() || false !== stripos($contents, 'interface '.$class) || false !== stripos($contents, 'trait '.$class)) { + $old = setlocale(LC_ALL, 'C'); $classes .= sprintf(" '%s' => '%s',\n", strtolower($class), substr(str_replace($libDir, '', $file), 1)); + setlocale(LC_ALL, $old); } }