|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2013-02-18 20:48 UTC] kusmierz at o2 dot pl
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) "->"
}
}
Patchesbug64239-2.patch (last revision 2013-03-21 09:06 UTC by dmitry@php.net)bug64329.patch (last revision 2013-03-21 08:18 UTC by laruence@php.net) bug64239.patch (last revision 2013-03-21 06:04 UTC by laruence@php.net) Pull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 10:00:01 2025 UTC |
I've added another patch (bug64239-2.patch), but it's incorrect anyway :( Test script: --------------- <?php class A { public function test() {} } class B { use T2 { t2method as Bmethod; } } trait T2 { public function t2method() { debug_print_backtrace(); } } $b = new B(); $b->t2method(); $b->Bmethod(); Expected result: ---------------- #0 B->t2method() called at [test.php:14] #0 B->Bmethod() called at [test.php:15] Actual result: -------------- #0 B->Bmethod() called at [test.php:14] #0 B->Bmethod() called at [test.php:15]