Bug #52029 [NEW]: create_alias namespaces
| From: | rustyj4ck at gmail dot com | Date: | Wed, 09 Jun 2010 11:08:29 +0000 |
| Subject: | Bug #52029 [NEW]: create_alias namespaces | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-151247@lists.php.net to get a copy of this message | ||
From:
Operating system: all
PHP version: 5.3.2
Package: Class/Object related
Bug Type: Bug
Bug description:create_alias namespaces
Description:
------------
Cant create alias to class in different namespace.
Created object (alias instance) return type of base class,
not alias.
Test script:
---------------
<?php
namespace tf\users {}
namespace tf\core {
class collection {
private $_cl;
function __construct() { $this->_cl = get_class($this); }
function get_cl() { return $this->_cl; }
}
class core {
private $_cl;
function register($name) {
$from = 'tf\\core\\collection';
$to = 'tf\\users\\' . $name;
printf ("aliasing %s --> %s : %s <br/> \n", $from, $to,
class_alias($from, $to)?'OK':'FAIl');
$a = new $to ();
$this->_cl = get_class($a);
return $a;
}
function get_cl() { return $this->_cl; }
}
}
namespace {
use tf\core\core;
$core = new core();
$test = $core->register('test');
printf("core: %s, result: %s, get_class: %s <br/>\n", $core->get_cl(),
$test->get_cl(), get_class($test));
}
Expected result:
----------------
tf\users\test
Actual result:
--------------
aliasing tf\core\collection --> tf\users\test : OK
core: tf\core\collection, result: tf\core\collection, get_class:
tf\core\collection
--
Edit bug report at http://bugs.php.net/bug.php?id=52029&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=52029&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=52029&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=52029&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=52029&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=52029&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=52029&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=52029&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=52029&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=52029&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=52029&r=support
Expected behavior: http://bugs.php.net/fix.php?id=52029&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=52029&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=52029&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=52029&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52029&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=52029&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=52029&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=52029&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=52029&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=52029&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=52029&r=mysqlcfg