How do you think the PureMVC guy tests this autoload function?
/**
* Checks all paths defined in $_includePaths for
* the existence of $class and loads $class if found.
*
* @param string $class The class to search for.
*/
function __autoload( $class )
{
$_includePaths = array(
PMVC_BASE_DIR . '/org/puremvc/php/core',
PMVC_BASE_DIR . '/org/puremvc/php/interfaces',
PMVC_BASE_DIR . '/org/puremvc/php/patterns',
PMVC_BASE_DIR . '/org/puremvc/php/patterns/command',
PMVC_BASE_DIR . '/org/puremvc/php/patterns/facade',
PMVC_BASE_DIR . '/org/puremvc/php/patterns/mediator',
PMVC_BASE_DIR . '/org/puremvc/php/patterns/observer',
PMVC_BASE_DIR . '/org/puremvc/php/patterns/proxy',
);
$classPath = get_include_path();
$classPathTokens = explode( ':', $classPath );
$classXtn = '.php';
foreach ($classPathTokens as $prefix)
{
foreach ($_includePaths as $includePath)
{
$path = "$includePath/$class$classXtn";
if (file_exists($path))
{
require_once $path;
return;
}
}
}
}
Taken from: http://svn.puremvc.org/PureMVC_PHP/tags/1.0.2/puremvc_autoloader.php
Dude, did you know that your get_include_path() is not used at all in this autoload function?
But here, I unit tested it for you
If you don’t get this joke see here
Advertisement

August 27, 2009 at 2:30 am |
[...] more here: __sh*tload to the rescue! « baaaaaad php usage exposed [...]
August 27, 2009 at 4:55 am |
[...] Here is the original: __sh*tload to the rescue! « baaaaaad php usage exposed [...]
August 27, 2009 at 2:40 pm |
Rather than post on your blog, it might be a good idea to post this on the PureMVC PHP forum.
-=Cliff>
August 27, 2009 at 2:40 pm |
http://forums.puremvc.org/index.php?board=17.0
August 27, 2009 at 2:58 pm |
Thanks, applied for an account, waiting to be approved.