From:             kusmierz at o2 dot pl
Operating system: Ubuntu,Debian,Windows
PHP version:      5.4.11
Package:          *General Issues
Bug Type:         Bug
Bug description:Debug backtrace changed behavior since 5.4.10 or 5.4.11

Description:
------------
The debug_backtrace behavior has been changed since 5.4.9. Previously first
method 
in backtrace array was an alias name (Bmethod in my example) which seems to
be ok 
as only one possibility to check name of trait's aliased method name (see
also 
#61033). Now it returns trait's method name (t2method), which is incorrect
in my 
mind - I can't now check which method was originally called.

Test script:
---------------
class A {
        use T1;
        public function test() { $this->backtrace(); }
}
class B {
        use T2 { t2method as Bmethod; }
}
trait T1 {
        protected function backtrace() {
                $b = new B();
                $b->Bmethod();
        }
}
trait T2 {
        public function t2method() {
                var_dump(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1));
        }
}
$a = new A(); $a->test();

Expected result:
----------------
// php 5.4.9
array(1) {
  [0]=>
  array(5) {
    ["file"]=>
    string(24) "/home/adam/test/test.php"
    ["line"]=>
    int(25)
    ["function"]=>
    string(7) "Bmethod" // OK;
    ["class"]=>
    string(1) "B"
    ["type"]=>
    string(2) "->"
  }
}

Actual result:
--------------
// php 5.4.11
array(1) {
  [0] =>
  array(5) {
    'file' =>
    string(19) "/home/adam/test.php"
    'line' =>
    int(25)
    'function' =>
    string(8) "t2method" // !
    'class' =>
    string(1) "B"
    'type' =>
    string(2) "->"
  }
}


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

Reply via email to