Hi!
This is actually already supported. The SplClassLoader$mode does exactly that. The $mode can be one of these values: - MODE_NORMAL: Throws error while attempting to include an unexistent file
Why this should even exist? It's never OK for generic autoloader to produce any errors when it can't load the class, because it makes it unusable with other loaders.
- MODE_DEBUG: This one can work together with the other two, allowing a validation of class/interface/trait presence in the file. Basically, it requires the file and then checks if the item exists in scope.
Not sure debug adds much here - if the class is not found, you'll be notified by the engine anyway, so what's the added value?
Actually they do not map the same file. Here is the path of each one: new \Foo\Bar\Baz; => [path]/Foo/Bar/Baz.php new \Foo\Bar_Baz; => [path]/Foo/Bar_Baz.php
That's not what I see in the RFC: \namespace\package\Class_Name /path/to/project/lib/vendor/namespace/package/Class/Name.php
Regarding the require_once change, it's not really needed. The reason is because class loading would never be triggered again if the class/trait/interface is already loaded. The require_once is extremely slow than require due to this check.
The check is just a hash lookup, and you'll have to check for file existence anyway...
Based on that, I'm pro to change the class to SplPsr0ClassLoader or SplPsr0Loader.
This name looks way too L33t :) -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php