Using `exec()` in an autoloader After reviewing autoloader functions on the site, I didn't see anything like this, and I was wonder what may be wrong with this? 

function findNloader($classFile){
    $file = exec("find ./ -name ".$classFile.".php"); 
    if(file_exists($file)){
        return require $file; 
    } else {
        return false; 
    }
}


The shell command returns false if somebody were to ever manage to inject something like: 

../../../../sudoers  or the like... 

And of course, it could be used with
spl_autoload_register() -- and if the file path were configured properly, it could find anything without chaining down autoload functions.  I understand that if it were pointed at a very large project, it might be resource intensive -- but with a direct enough focus, is there anything else wrong with this?

It could then be shortened into: 

public function findnload($class) {
    return (file_exists($st = exec("find ./ -name ".$class.".php")) ?
    require $st : false);
}


And that looks quite elegant, to me.
Or if you want to be safe: 

public function findnload($class) {
    return (file_exists($st = exec("find ./ -name ".$class.".php")) &amp;&amp;
           (length($class) &lt; $thirtyTwoOrSo) || ($someOtherSafetyCriteria)
           ?
    require $st : false);
}


Any thoughts ?
The main problem I see with this is that you are assuming a few things:


I am running Linux - Are you? The production server might, but are you locally running linux as well? Maybe, but will the next collaborator/developer?
My Linux distro supports find - That also may or may not be true. Some distros will have that built in, some will not.


You are tying yourself to a specific environment, that's not good. A better approach would be to make sure that the class file sits under the path you expect it to, relatively to a file you know where it is relatively to the project.