Re: get_class inconsistency
| From: | Benjamin Eberlei | Date: | Wed, 23 Feb 2011 18:48:18 +0000 |
| Subject: | Re: get_class inconsistency | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-51521@lists.php.net to get a copy of this message | ||
No, this wouldnt be backwards compatible to the PHP 5.2 behavior, hence inconsistent.
The convention is class names in strings are ALWAYS fully qualified, therefore the prefix backslash
is not necessary.
On Wed, 23 Feb 2011 15:14:45 -0300
Martin Scotta <martinscotta@gmail.com> wrote:
> Hi all,
>
> would it be safer that get_class return the fully qualified class name ?
>
> namespace A\B\C {
> class Test { }
> echo get_class( new Test ); // it prints A\B\C\Test
> };
>
> It should print \A\B\C\Test, as explained
> http://php.net/manual/en/language.namespaces.rules.php
>
> Martin Scotta