Bug #55086 [PATCH]: Namespace alias does not work inside trait's use block
| From: | pierrick@php.net | Date: | Fri, 01 Jul 2011 20:33:03 +0000 |
| Subject: | Bug #55086 [PATCH]: Namespace alias does not work inside trait's use block | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-161478@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=55086&edit=1
ID: 55086
Patch added by: pierrick@php.net
Reported by: andrey dot garbuz at gmail dot com
Summary: Namespace alias does not work inside trait's use
block
Status: Open
Type: Bug
Package: Scripting Engine problem
Operating System: Fedora 14
PHP Version: 5.4SVN-2011-06-30 (SVN)
Block user comment: N
Private report: N
New Comment:
The following patch has been added/updated:
Patch Name: bug55086.phpt
Revision: 1309552383
URL: https://bugs.php.net/patch-display.php?bug=55086&patch=bug55086.phpt&revision=1309552383
Previous Comments:
------------------------------------------------------------------------
[2011-06-30 07:47:02] andrey dot garbuz at gmail dot com
Description:
------------
Namespace aliases do not work only inside trait's use block. If provide fully
qualified namespace then example works fine:
class A {
use T1, T2 {
\N1\T1::hello insteadof \N1\T2;
}
}
Test script:
---------------
<?php
namespace N1 {
trait T1 {
public function hello() { return 'hello from t1'; }
}
trait T2 {
public function hello() { return 'hello from t2'; }
}
}
namespace N2 {
use N1\T1;
use N1\T2;
class A {
use T1, T2 {
T1::hello insteadof T2;
}
}
$a = new A;
echo $a->hello(), PHP_EOL;
}
Expected result:
----------------
hello from t1
Actual result:
--------------
PHP Fatal error: Trait 'T1' not found in test_script.php on line 24
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=55086&edit=1