#48665 [Opn->Bgs]: class_alias allows impossible classes
| From: | johannes@php.net | Date: | Tue, 23 Jun 2009 16:40:12 +0000 |
| Subject: | #48665 [Opn->Bgs]: class_alias allows impossible classes | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-138708@lists.php.net to get a copy of this message | ||
ID: 48665
Updated by: johannes@php.net
Reported By: dams@php.net
-Status: Open
+Status: Bogus
Bug Type: Class/Object related
Operating System: Mac OS X Server 10.5.6
PHP Version: 5.3.0RC4
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
That's kind of expected and is consistent with with stuff like
define(), ${'what ever'} and others.
Previous Comments:
------------------------------------------------------------------------
[2009-06-23 16:29:37] dams@php.net
Description:
------------
The original class is checked, but the checks a too lax on the alias
itself.
I suggest the alias's name should follow the same rules as the class
itself.
Admittedly, the following may work in conjunction with the problem
reported :
<?php
class foo { }
var_dump(class_alias('foo', '$$$'));
$b = "$$$";
$a = new $b;
var_dump($a);
?>
Reproduce code:
---------------
<?php
class foo { }
var_dump(class_alias('foo', '999'));
var_dump(class_alias('foo', ''));
var_dump(class_alias('foo', true));
var_dump(class_alias('foo', false));
var_dump(class_alias('foo', null));
var_dump(class_alias('foo', '$$$'));
var_dump(class_alias('foo', ';;'));
var_dump(class_alias('foo', '"'));
var_dump(class_alias('foo', '::'));
?>
Expected result:
----------------
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
Actual result:
--------------
bool(true)
bool(true)
bool(true)
PHP Warning: Cannot redeclare class in /Users/alterway/bin/php-
5.3.0RC4/Zend/tests/- on line 8
Warning: Cannot redeclare class in /Users/alterway/bin/php-
5.3.0RC4/Zend/tests/- on line 8
bool(false)
PHP Warning: Cannot redeclare class in /Users/alterway/bin/php-
5.3.0RC4/Zend/tests/- on line 9
Warning: Cannot redeclare class in /Users/alterway/bin/php-
5.3.0RC4/Zend/tests/- on line 9
bool(false)
bool(true)
bool(true)
bool(true)
bool(true)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48665&edit=1