Req #61465 [Opn->Csd]: class_alias cannot create alias for standard class
| From: | krakjoe@php.net | Date: | Wed, 09 Oct 2013 06:07:55 +0000 |
| Subject: | Req #61465 [Opn->Csd]: class_alias cannot create alias for standard class | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-10447@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=61465&edit=1
ID: 61465
Updated by: krakjoe@php.net
Reported by: php at shark dot kom dot cz
Summary: class_alias cannot create alias for standard class
-Status: Open
+Status: Closed
Type: Feature/Change Request
Package: Documentation problem
Operating System: Debian
PHP Version: 5.3.10
-Assigned To:
+Assigned To: krakjoe
Block user comment: N
Private report: N
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation better.
Previous Comments:
------------------------------------------------------------------------
[2013-10-09 06:07:50] krakjoe@php.net
Automatic comment from SVN on behalf of krakjoe
Revision: http://svn.php.net/viewvc/?view=revision&revision=331737
Log: #61465 adjust description for clarity
------------------------------------------------------------------------
[2012-03-22 08:06:43] php at shark dot kom dot cz
OK, that shall be DOC bug. But why it can't alias standard classes? I'd like to alias
them.
------------------------------------------------------------------------
[2012-03-22 05:52:27] laruence@php.net
doc should doc that class_alias can only create a alias for user defined class
------------------------------------------------------------------------
[2012-03-22 05:51:40] laruence@php.net
This should be doc bug.
------------------------------------------------------------------------
[2012-03-21 14:32:17] php at shark dot kom dot cz
Description:
------------
Function class_alias cannot create alias for standard classes.
I'm using standard exceptions inspired by Java API for very long time. My exceptions was used
earlier than exceptions introduced by SPL. I'd like to use SPL's exceptions instead of my
exceptions in case they are defined, but I don't want to edit all codes to change exception
names used. Therefor I'd like to use class_alias to act SPL exceptions as exceptions expected
by applications.
Test script:
---------------
<?php
class_alias('InvalidArgumentException', 'IllegalArgumentException');
// Application
throw new IllegalArgumentException('Arg must be abcd')
Expected result:
----------------
thrown IllegalArgumentException
Actual result:
--------------
PHP Warning: First argument of class_alias() must be a name of user defined class in aliases.php:17
Fatal error: Class 'IllegalArgumentException' not found in aliases.php on line 28
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=61465&edit=1