Re: ReflectionContext for imports and namespace
| From: | Andreas Hennings | Date: | Mon, 11 Dec 2017 08:10:21 +0000 |
| Subject: | Re: ReflectionContext for imports and namespace | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-101311@lists.php.net to get a copy of this message | ||
On 11 December 2017 at 09:05, Marco Pivetta <ocramius@gmail.com> wrote:
> On 11 December 2017 at 08:46, Marco Pivetta <ocramius@gmail.com> wrote:
> > Indeed that already exists at
> > https://github.com/Roave/BetterReflection/blob/2.0.1/docs/
> features.md#analysing-types-from-docblocks
> > - relatively new lib, so it probably didn't get noticed upfront in here..
>
>
> Yes, parser / userland solutions exist for this purpose.
> (I have seen BetterReflection)
>
> I just thought since this information is already available, a library
> that uses reflection API should not need a userland parser to get it.
>
>
> Unless the codebase being analyzed is trusted and not legacy
> (wordpress-style) any tool based on the current reflection API is basically
> a potential security issue or a set of potentially harmful side-effects.
> The reason for me and James building BetterReflection was essentially that,
> since the current API is flawed and not really fixable without BC breaks
> (removing the side-effect), so I strongly encourage any code analysis tool
> to just use the userland adapters we wrote, and only switch to core
> reflection when performance is more critical than security.
>
These side effects would be that the class loader loads files which can
break things?
>
> This also means that if your addition makes it into the language it will
> be implemented also by those adapters BTW, so push on 👍
>