Re: include path issue
| From: | Justin Patrin | Date: | Tue, 13 Dec 2005 22:04:55 +0000 |
| Subject: | Re: include path issue | ||
| References: | 1 2 3 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-40722@lists.php.net to get a copy of this message | ||
On 12/13/05, Lukas Smith <lsmith@php.net> wrote:
> Alan Knowles wrote:
> > Remove the userland file exists check - Seems like it's causing more
> > problems than it solves...
>
> Well looking at it, it seems to make more sense to do the fileExists()
> check if the include failed, since the entire purpose is to determine
> the proper error message (file missing or file has parse errors). This
> should even speed things up a bit when loading drivers.
>
Except that if an include fails it may fail due to a parse error,
which kills the script totally and this is whey we can't use @ on
include_once. To run file_exists after include_once you'd need to have
the @ to silence the not found error and we don't want that.
> However there is another use case where I cannot do without fileExists()
> and that is in the loadModule() method. The problem is that some modules
> are backend specific and some are not:
>
> MDB2_Extended
>
> vs.
>
> MDB2_Driver_Datatype_mysql
>
> Since I do not want to make the user think about this, I check if the
> given file exists for once case and if it does not try the other case in
> order to determine what file to include and how to load the instance.
>
> I will add a parameter for the user to hint this in loadModule() if they
> are in the unfortunate situation of safe_mode ..
>
--
Justin Patrin