[TYPO3-project-4-3] TYPO3 autoloader case sensitivity: your opinion please
Francois Suter
fsu-lists at cobweb.ch
Fri Sep 18 10:14:13 CEST 2009
Hi all,
As you may have noticed, TYPO3's autoloader is case-sensitive while
PHP's is not (see [1]). This is confusing because developers will expect
the TYPO3 autoloader to be case-*in*sensitive too.
Looking into t3lib_autoloader, the problem is clear. In
t3lib_autoloader::getClassPathByRegistryLookup(), there's the following
line:
$className = strtolower($className);
but when the ext_autoload.php files are loaded, there's no check on what
case was used.
There are two ways to solve that:
1) document the fact that class names must be entered all lowercase in
the ext_autoload.php files (actually, there's no autoloader
documentation at all, and this particular point would have to be a big,
bold warning)
2) loop on all the entries in the ext_autoload.php file and apply
strtolower on the class names (i.e. the array keys).
I don't know the best solution. Solution 1 is the easiest one and a
badly spelled class name is quickly obvious. Solution 2 plays nicer with
developers, but with an added overhead, especially since (as far as I
can tell) the autoloader registry is not cached.
So I would rather go for 1. And you?
Cheers
--
Francois Suter
Cobweb Development Sarl - http://www.cobweb.ch
[1] http://bugs.typo3.org/view.php?id=11871
More information about the TYPO3-project-4-3
mailing list