From:             imenem at inox dot ru
Operating system: Debian GNU/Linux
PHP version:      5.4.11
Package:          Scripting Engine problem
Bug Type:         Bug
Bug description:Insteadof not work for class method in 5.4.11

Description:
------------
In PHP 5.4.4 test script works as expected, in 5.4.11 script caused fatal
error.

Test script:
---------------
<?php

class TestParentClass
{
    public function method()
    {
        print_r('Parent method');
        print "\n";
    }
}

trait TestTrait
{
    public function method()
    {
        print_r('Trait method');
        print "\n";
    }
}

class TestChildClass extends TestParentClass
{
    use TestTrait
    {
        TestTrait::method as methodAlias;
        TestParentClass::method insteadof TestTrait;
    }
}

(new TestChildClass)->method();
(new TestChildClass)->methodAlias();

Expected result:
----------------
Parent method
Trait method

Actual result:
--------------
Fatal error: Trait TestParentClass is not used in test.php on line 28

-- 
Edit bug report at https://bugs.php.net/bug.php?id=64235&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=64235&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=64235&r=trysnapshot53
Try a snapshot (trunk):     
https://bugs.php.net/fix.php?id=64235&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=64235&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=64235&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=64235&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=64235&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=64235&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=64235&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=64235&r=notwrong
Not enough info:            
https://bugs.php.net/fix.php?id=64235&r=notenoughinfo
Submitted twice:            
https://bugs.php.net/fix.php?id=64235&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=64235&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64235&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=64235&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=64235&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=64235&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=64235&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=64235&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=64235&r=mysqlcfg

Reply via email to