Req #61759 [Com]: class_alias() should accept classes with leading backslashes
| From: | contact at jubianchi dot fr | Date: | Tue, 27 Aug 2013 12:55:41 +0000 |
| Subject: | Req #61759 [Com]: class_alias() should accept classes with leading backslashes | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-181242@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=61759&edit=1
ID: 61759
Comment by: contact at jubianchi dot fr
Reported by: aharvey@php.net
Summary: class_alias() should accept classes with leading
backslashes
Status: Open
Type: Feature/Change Request
Package: Class/Object related
Operating System: Irrelevant
PHP Version: master-Git-2012-04-18 (Git)
Block user comment: N
Private report: N
New Comment:
Also agree with the fact that the leading backslashes are redundant but the point
is that class_alias returns a value saying all went fine (bool(true)) when the
alias is not reachable after the call.
Previous Comments:
------------------------------------------------------------------------
[2013-08-27 12:10:10] nikic@php.net
I'm not convinced that allowing a leading \ is something we should strive towards. The \ is
unnecessary and redundant (as string names are always fully qualified). I'd rather allow only
the canonical form.
------------------------------------------------------------------------
[2013-08-27 12:04:43] jpauli@php.net
Yep, let's start finding all places where classes as strings can be used, and
patch them all to use zend_lookup_class().
There shouldn't be tons of them AFAIR.
------------------------------------------------------------------------
[2013-08-27 10:19:53] contact at jubianchi dot fr
I agree with Johannes about consistency.
The severity is not really is not very high and this use case can easily be
handled at a useland level.
As long as this behavior is not "fixed" I think a warning on the doc shoudl be
enough, even if I'd like to see it fixed (but as I said, it's not a big deal at
the moment).
BTW, thanks for you work Julien :)
------------------------------------------------------------------------
[2013-08-27 10:08:00] johannes@php.net
Technically we could, but it adds some inconsistency if one place allows this but others not and
that should be avoided.
------------------------------------------------------------------------
[2013-08-27 09:46:53] jpauli@php.net
The following patch has been added/updated:
Patch Name: fix-class_alias
Revision: 1377596813
URL: https://bugs.php.net/patch-display.php?bug=61759&patch=fix-class_alias&revision=1377596813
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=61759
--
Edit this bug report at https://bugs.php.net/bug.php?id=61759&edit=1