Lukas Kahwe Smith wrote:
> I have written an RFC for a more efficient solution to get rid of the
> common fopen() hack inside autoloaders:
> if ($fp = @fopen($file, 'r', true)) {
> fclose($fp);
> include $file;
> }
> 
> Here is the gist of the proposal:
> In order to solve the above issues this RFC proposes the addition of a
> new construct/function for now called “autoload_include” for lack of a
> better name that largely behaves like the “include” does today with the
> following differences, that when the include failed because of a missing
> file no warning is raised and php null is returned.

Alternatively include() could be extended to allow resources, so the
above would turn info

if ($fp = @fopen($file, 'r', true)) {
        include($fp);
        fclose($fp);
}

Pros: No new function name needed, works with all streams (e.g. phar?)
Cons: fopen/fclose are still needed, determining real path not obvious
Maybes: Any security implications? Don't think so but not sure.

I like the general idea, just throwing in another option,
- Chris

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to