debug_backtrace not consistent with Zend when __call is involved
Using this:
class A
{
public function __call($methodName, $args)
{
var_dump(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS));
}
}
$a = new A;
$a->someNonExistingFunc();
Result in PHP:
$ php backtrace.php
array(2) {
[0] =>
array(5) {
'file' =>
string(41) "/vagrant/www/fdldebug/tests/backtrace.php"
'line' =>
int(11)
'function' =>
string(6) "__call"
'class' =>
string(1) "A"
'type' =>
string(2) "->"
}
[1] =>
array(5) {
'file' =>
string(41) "/vagrant/www/fdldebug/tests/backtrace.php"
'line' =>
int(11)
'function' =>
string(19) "someNonExistingFunc"
'class' =>
string(1) "A"
'type' =>
string(2) "->"
}
}
Result in HHVM
$ hhvm backtrace.php
array(1) {
[0]=>
array(5) {
["file"]=>
string(41) "/vagrant/www/fdldebug/tests/backtrace.php"
["line"]=>
int(11)
["function"]=>
string(6) "__call"
["class"]=>
string(1) "A"
["type"]=>
string(2) "->"
}
}
It seems like the reference to the non existing function that __call is using is not being outputted
may be same as #1018 ?
sucks they tag this as wont fix. I am writing something that depends on debug_backtrace :\
@franz-deleon as u can see, we too)
This isn't the same issue as #1018 - class_exist() isn't actually implemented as a function call in HHVM. The Zend behavior is strange here, given that the function in the back trace doesn't exist. Why do you need this behavior, given that the method name gets passed to __call anyway?
@freddemmott i need a way to trace back where __call is called refering the non existing function that zend created on its back trace. my example is a simpler version and using call is really irrelevant and i have to grab the data from the debug_backtrace
Sorry, could you provide a more thorough example or explanation as to why you need to get the data this way?
@fredemmott I have to grab the file and line number where the function is called. I can use the __call trace data but I do not think its too reliable compared to where "function" array key where the non existing function is named.
I don't think we're going to support this; if you share your code or submit a pull request, we'd be happy to make suggestions, and possibly reconsider.