Re: Re: RFC: source files without opening tag
| From: | Ángel González | Date: | Mon, 09 Apr 2012 12:26:39 +0000 |
| Subject: | Re: Re: RFC: source files without opening tag | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-59501@lists.php.net to get a copy of this message | ||
On 09/04/12 13:29, Tom Boutell wrote:
> I would like to clarify what this RFC actually says. Let's try to keep
> this thread to the pros and cons of this specific proposal.
>
> The following new keyword would be introduced:
>
> require_path
I don't like the keyword name. Too confusing with the include_path
configuration option for something very different.
What about require_file ?
> This keyword has two parameters of which the second is optional. The
> first parameter is the path (filename or URL) to be required, and
> behaves exactly as the sole parameter of the require keyword behaves.
> The second parameter is an associative array.
Does it require brackets?
> If 'warn' is present and true, a loading or compilation error results
> in E_WARNING (per the current behavior of the include keyword). If
> warn is absent or false, a loading or compilation error results in
> E_COMPILE_ERROR (per the current behavior of the require keyword).
What if I want to silently ignore a missing-file condition?
Ie. no warning or compile error if there file is not there (presumably
to skip the need of a file_exist), yet receive all warnings generated by
the included code.
What about 'missing'=> 'error' / 'warn' / 'ignore' ?
> If 'code' is present and true, the parser begins reading the file as
> if a <?php open tag had already been encountered. If code is absent or
> false, the parser reads the file beginning in “HTML mode,” exactly as
> the require keyword does today.
I think "reading the file as if a <?php open tag had already been
encountered" should add
"with the exception that an explicit <?php exactly at the beginning of
the file is not a parse error but silently ignored".
Best regards