Edit report at https://bugs.php.net/bug.php?id=55086&edit=1

 ID:                 55086
 Updated by:         fel...@php.net
 Reported by:        andrey dot garbuz at gmail dot com
 Summary:            Namespace alias does not work inside trait's use
                     block
-Status:             Assigned
+Status:             Closed
 Type:               Bug
 Package:            Scripting Engine problem
 Operating System:   Fedora 14
 PHP Version:        5.4SVN-2011-06-30 (SVN)
 Assigned To:        gron
 Block user comment: N
 Private report:     N

 New Comment:

This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

Thanks for the patch!


Previous Comments:
------------------------------------------------------------------------
[2011-07-02 13:12:21] fel...@php.net

Automatic comment from SVN on behalf of felipe
Revision: http://svn.php.net/viewvc/?view=revision&revision=312817
Log: - Fixed bug #55086 (Namespace alias does not work inside trait's use block)
  patch by: Pierrick

------------------------------------------------------------------------
[2011-07-01 16:33:03] pierr...@php.net

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

------------------------------------------------------------------------
[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

Reply via email to