Edit report at https://bugs.php.net/bug.php?id=64070&edit=1
ID: 64070
Comment by: inefedor at gmail dot com
Reported by: denny dot reeh at gmail dot com
Summary: Inheritance with Traits failed with error
Status: Open
Type: Bug
Package: Scripting Engine problem
PHP Version: 5.4.11
Block user comment: N
Private report: N
New Comment:
As far as I see this bug is resolved, could we close it?
Previous Comments:
------------------------------------------------------------------------
[2013-02-12 12:55:50] maciej dot sz at gmail dot com
This bug seemed to be also merged into 5.5 branch, tested with 5.5.0alpha4
------------------------------------------------------------------------
[2013-02-11 01:42:15] manchokapitancho at gmail dot com
This is also present in 5.4.12RC1.
Please, fix it before 5.4.12 rolls out.
This appears to be a regression.
------------------------------------------------------------------------
[2013-02-01 11:41:49] source dot spider at gmail dot com
@denny.reeh
OS: Win7/x64
$ php --version
PHP 5.4.11 (cli) (built: Jan 16 2013 20:26:43)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
$ php .sandbox.php
PHP Fatal error: Trait method first_function has not been applied, because
there are collisions with other trait methods on first_class in ########## on
line 25
Fatal error: Trait method first_function has not been applied, because there
are
collisions with other trait methods on first_class in ########## on line 25
------------------------------------------------------------------------
[2013-01-25 11:26:34] denny dot reeh at gmail dot com
example works with 5.4.10
------------------------------------------------------------------------
[2013-01-25 11:23:43] denny dot reeh at gmail dot com
Description:
------------
if two traits have the same function name and a trait uses another trait and
using the as operator for aliases the function, it failed with fatal error.
Test script:
---------------
<?php
trait first_trait
{
function first_function()
{
echo "From First Trait\n";
}
}
trait second_trait
{
use first_trait {
first_trait::first_function as second_function;
}
function first_function()
{
echo "From Second Trait\n";
}
}
class first_class
{
use second_trait;
}
$obj = new first_class();
$obj->first_function();
$obj->second_function();
Expected result:
----------------
>From Second Trait
>From First Trait
Actual result:
--------------
PHP Fatal error: Trait method first_function has not been applied, because
there are collisions with other trait methods on first_class in test.php on
line 25
PHP Stack trace:
PHP 1. {main}() /data/www/helix/test.php:0
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=64070&edit=1