phacility / xhprof

XHProf is a function-level hierarchical profiler for PHP and has a simple HTML based user interface.
http://pecl.php.net/package/xhprof
Apache License 2.0
2.6k stars 925 forks source link

segfault with php 5.5 when used in auto_prepend_file #47

Open jocel1 opened 10 years ago

jocel1 commented 10 years ago

Hi,

I have a simple script with

<?php phpinfo(); exit;

If I put xhprof_enable(); before phpinfo();, all is working properly.

However, if xhprof_enable() is loaded through an auto_prepend_file, php segfaults. Could you take a look at this issue ?

Thanks ! Jocelyn

jocel1 commented 10 years ago

The crash seems to occur in hp_get_function_name(). If I remove the else branch of the if (func) { } else { }, php doesn't crash anymore. Perhaps the curr_op = data->prev_execute_data->opline->extended_value; is not ok in this case ?

jocel1 commented 10 years ago

If I'm doing the following test, it doesn't crash anymore :

if (data->prev_execute_data) { curr_op = data->prev_execute_data->opline->extended_value; } else { curr_op = data->opline->extended_value; }

However, I have a "???_op" in the list of functions

jocel1 commented 10 years ago

I've just made a PR for this issue : https://github.com/phacility/xhprof/pull/48