Re: [RFC] Extension Prepend Files
| From: | Pierre Joye | Date: | Fri, 09 Jan 2015 02:58:32 +0000 |
| Subject: | Re: [RFC] Extension Prepend Files | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-80296@lists.php.net to get a copy of this message | ||
On Thu, Jan 8, 2015 at 6:35 PM, François Laupretre <francois@tekwire.net> wrote:
>> De : Pierre Joye [mailto:pierre.php@gmail.com]
>>
>> > We solved some of the other problems by only allowing definitions, no
>> side-effects - classes, constants, namespaces etc. We do not allow code
>> outside of a function body here.
>>
>> Yes, we will have to do that, no matter what we choose. I am however
>> not sure how to do it with the current engine design. Using
>> zend_compile (or a derived implementation) may help.
>
> Is there a technical problem with code located outside of definitions, or is it just a
> convention (PSR already contains this rule) ? I understand the problems it poses in HHVM, but I
> don't see why we should check that with the engine as it is structured now. Even if we can
> detect such questionable usage (and we can detect it quite easily just using tokenizer output), IMO,
> we are not responsible of what developers put in their scripts.
I was too vague.
If some code is loaded and part of it will be always executed even if
not used at all in a request, this will have side effects. Also
besides the impact of having code being ran on each request, I do not
think it is good idea to being to have top context running code, at
all :)
Cheers,
--
Pierre
@pierrejoye | http://www.libgd.org