Bug #64239 [Asn]: Debug backtrace changed behavior since 5.4.10 or 5.4.11
From: laruence@php.net Date: Tue, 19 Feb 2013 08:43:01 +0000 Subject: Bug #64239 [Asn]: Debug backtrace changed behavior since 5.4.10 or 5.4.11 References: 1 Groups: php.bugs Request: Send a blank email to php-bugs+get-177208@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=64239&edit=1
ID: 64239
Updated by: laruence@php.net
Reported by: kusmierz at o2 dot pl
Summary: Debug backtrace changed behavior since 5.4.10 or
5.4.11
Status: Assigned
Type: Bug
Package: *General Issues
Operating System: Ubuntu,Debian,Windows
PHP Version: 5.4.11
Assigned To: dmitry
Block user comment: N
Private report: N
New Comment:
yes, that alias name gave us too many pains :)...
add a new alias_name is a easy and clear way.
thanks
Previous Comments:
------------------------------------------------------------------------
[2013-02-19 07:11:45] dmitry@php.net
Laruence, you are right. Reflection, debug_backtrace() and get_class_methods() are affected.
It would be good to fix it, however, I don't see a good way to do it, and I don't like to
introduce a new hack. (e.g. resolving alias name by looking into hash table key).
Actually we have the same situation with class aliases.
In general, we can fix it in 5.5 using some inefficient way (e.g. add
op_array->alias_function_name)
Any ideas are welcome.
------------------------------------------------------------------------
[2013-02-19 04:14:26] laruence@php.net
seems due to the new implemention of trait, not only debug_backtrace, I think the
reflection is also affected.
dmitry, do you think this should be fixed?
thanks
------------------------------------------------------------------------
[2013-02-18 20:48:20] 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) "->"
}
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=64239&edit=1
Thread (13 messages)
- Bug #64239 [Opn]: Debug backtrace changed behavior since 5.4.10 or 5.4.11
- Bug #64239 [Asn]: Debug backtrace changed behavior since 5.4.10 or 5.4.11
- Bug #64239 [Asn]: Debug backtrace changed behavior since 5.4.10 or 5.4.11
- Bug #64239 [Com]: Debug backtrace changed behavior since 5.4.10 or 5.4.11
- Bug #64239 [Asn]: Debug backtrace changed behavior since 5.4.10 or 5.4.11
- Bug #64239 [Asn]: Debug backtrace changed behavior since 5.4.10 or 5.4.11
- Bug #64239 [PATCH]: Debug backtrace changed behavior since 5.4.10 or 5.4.11
- Bug #64239 [Asn]: Debug backtrace changed behavior since 5.4.10 or 5.4.11
- Bug #64239 [PATCH]: Debug backtrace changed behavior since 5.4.10 or 5.4.11
- Bug #64239 [Com]: Debug backtrace changed behavior since 5.4.10 or 5.4.11
- Bug #64239 [PATCH]: Debug backtrace changed behavior since 5.4.10 or 5.4.11
- Bug #64239 [Asn->Csd]: Debug backtrace changed behavior since 5.4.10 or 5.4.11
| « previous | php.bugs (#177208) | next » |
|---|