Re: Silenced include(_once) calls

From: Date: Wed, 08 Mar 2006 20:57:39 +0000
Subject: Re: Silenced include(_once) calls
References: 1 2 3 4 5 6 7 8 9  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-41727@lists.php.net to get a copy of this message
bertrand Gugger wrote:
Lukas Smith wrote:
Hi, I have made the relevant changes in MDB2 and LiveUser. Would be a nice static method in PEAR some day .. regards, Lukas
for those not following cvs:
    function fileExists($file)
    {
-        $dirs = explode(PATH_SEPARATOR, ini_get('include_path'));
-        foreach ($dirs as $dir) {
-            if (is_readable($dir . DIRECTORY_SEPARATOR . $file)) {
-                return true;
-            }
+        $fp = @fopen($file, 'r', true);
+        if (is_resource($fp)) {
+            @fclose($fp);
+            return true;
        }
        return false;
    }
I see SDG applies the same ...
I still wonder what is the goal. I assume you mean fileExistsToInclude($file) For the record it was some discussion between Del, Paul and Justin about it in Text_Wiki. Then, after having introduced it, we pulled it back. We just include_once now, as it is some implementer's choice. Lukas admitted he does it for implementer's comfort: "... For convinience I first made this entirely transparent to the user..." from http://beeblex.com/lists/index.php/php.pear.dev/41612?s=l%3Aphp.pear.dev+lukas SDG did not have such feature, and does not need it. Such work-around should really be reserved for really "optional" things. Consider implementers are mature. Regards -- toggg

« previous php.pear.dev (#41727) next »