Hi there. I'm wondering if anyone has a good tip.
I'm using var_dump(debug_backtrace()); trying to find a specific function.
The script works fine. No errors, and apparently its doing what I want it to do.
although i want to edit / amend the function..
I know where the function is USED, however I cannot find where it's
actually included from.. i've done word-searches on
glob("*.*");
glob("*/*.*");
glob("*/*/*.*");
glob("*/*/*/*.*"); etc... (there's only 3 levels of directories in this area..)
and using a text-search..
I've used backtrace immediately after using the function, however it
doesn't mention / show the function at all.
email_save_log_03($t);
$GLOBALS["FOUNDFILE"].="SAVING email_save_log_03();\n";
$GLOBALS["FOUNDFILE"].=print_r(debug_backtrace(), true)."\n";
it all gets logged, however i can't find where the save_log function
is and its not shown in the backtrace...
Any advice?
--
Gordon.
On 16/07/2024 17:02, gordonisnz@gmail.com wrote:
I've used backtrace immediately after using the function, however it
doesn't mention / show the function at all.
email_save_log_03($t);
$GLOBALS["FOUNDFILE"].="SAVING email_save_log_03();\n";
$GLOBALS["FOUNDFILE"].=print_r(debug_backtrace(), true)."\n";
it all gets logged, however i can't find where the save_log function
is and its not shown in the backtrace...
Any advice?
This is expected. debug_backtrace() shows the stack from the current point. Since the email_save_log_03 function has already ended at the point debug_backtrace() was called, it has left the stack and is not shown.
The function would only be mentioned if debug_backtrace() was called from inside the function (including another function called by the function in question).
Methods I would use to find where the function is defined:
* Open the project in a PHP-capable IDE such as PHPStorm. You can then ctrl-click (or equivalent for the IDE in question) the function call to go to where it's defined.
* On the linux command line: grep -irn 'function.*email_save_log' *
(.* is used here to handle any amount of unknown whitespace such as tabs, spaces, etc)
Another method you could try to find the function is to use Reflection. Specifically see PHP: ReflectionFunction::__construct - Manual
If you have access to the command line and you are on Linux you can try this find command replacing {root_of_application} with your application root.
find {root_of_application} -type f -exec grep -iHn “email_save_log_03(” {} ;
This will print out the filename and line of filename where it was found.
Eric
···
On 7/16/24 9:02 AM, gordonisnz@gmail.com wrote:
Hi there. I'm wondering if anyone has a good tip.
I'm using var_dump(debug_backtrace()); trying to find a specific function.
The script works fine. No errors, and apparently its doing what I want it to do.
although i want to edit / amend the function..
I know where the function is USED, however I cannot find where it's
actually included from.. i've done word-searches on
glob("*.*");
glob("*/*.*");
glob("*/*/*.*");
glob("*/*/*/*.*"); etc... (there's only 3 levels of directories in this area..)
and using a text-search..
I've used backtrace immediately after using the function, however it
doesn't mention / show the function at all.
email_save_log_03($t);
$GLOBALS["FOUNDFILE"].="SAVING email_save_log_03();\n";
$GLOBALS["FOUNDFILE"].=print_r(debug_backtrace(), true)."\n";
it all gets logged, however i can't find where the save_log function
is and its not shown in the backtrace...
Any advice?
Hi,
I need a free LAPM web hosting, any body provide some resource or information ?