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

 ID:                 62069
 Updated by:         larue...@php.net
 Reported by:        larue...@php.net
 Summary:            binding wrong traits if they have same name methods
 Status:             Open
 Type:               Bug
 Package:            Scripting Engine problem
 PHP Version:        5.4.3
-Assigned To:        
+Assigned To:        dmitry
 Block user comment: N
 Private report:     N

 New Comment:

Hi, dmitry, could you please look at this? thanks

the problem occurrs in zend_traits_merge_functions. in that function, it will 
unique the trait methods name. 

the fix will be a big change, since we should re-implemention the whole merge 
functions mechanism, maybe add the tarit name as a suffix to method name.

thanks


Previous Comments:
------------------------------------------------------------------------
[2012-05-19 06:30:40] larue...@php.net

Description:
------------
if a function binding more than two traits and they have same method name, the 
result is wrong.

Test script:
---------------
<?php
trait T1 {
    public function func() {
        echo "From T1\n";
    }
}

trait T2 {
    public function func() {
        echo "From T2\n";
    }
}

class Bar {
    public function func() {
        echo "From Bar\n";
    }
    use T1 {
        func as f1;
    }
    use T2 {
        func as f2;
    }
}

$b = new Bar();
$b->f2();

Expected result:
----------------
>From T2

Actual result:
--------------
>From T1


------------------------------------------------------------------------



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

Reply via email to