Page 1 of 1

who called this function?

Posted: Fri Jun 08, 2012 2:47 am
by wvoyance
I have turned the error_reporting(-1); on
The system told me a PHP error at one of my function.
But who called it? (since the program is too complicate. That function is called at many places.)
Is there anyway to know from the main program
A called function B, and B called C....etc.

Re: who called this function?

Posted: Fri Jun 08, 2012 4:14 am
by social_experiment
If there is an error about a function it must have been called somewhere in the script. Post the error here; if you use exceptions in your script then getTrace() will return an array you could use to determine where a problem in the script is originating from

Re: who called this function?

Posted: Fri Jun 08, 2012 6:09 am
by wvoyance
social_experiment wrote:If there is an error about a function it must have been called somewhere in the script. Post the error here; if you use exceptions in your script then getTrace() will return an array you could use to determine where a problem in the script is originating from

I did not use exception handling.

I post per your request.
===================================
PHP Error Message

Notice: Undefined variable: query in /home/public_html/catalog/admin/includes/functions/database.php on line 95

Free Web Hosting
1065 - Query was empty
=====================================
But I don't think it is useful. I know it is wrong at line95, and I know it is empty.
But I used var_dump to see the variable before calling this function, it is o.k.
How could it become empty?

In other programming languages I used before, they provide a trace back.
They will list who called this function, and ...trace back to the main program.

Re: who called this function?

Posted: Fri Jun 08, 2012 6:41 am
by social_experiment
wvoyance wrote:But I don't think it is useful. I know it is wrong at line95, and I know it is empty.
How is the variable 'query' created? Is it returned from the function in question? Paste line 95 of the script;

Re: who called this function?

Posted: Fri Jun 08, 2012 6:57 am
by wvoyance
social_experiment wrote:
wvoyance wrote:But I don't think it is useful. I know it is wrong at line95, and I know it is empty.
How is the variable 'query' created? Is it returned from the function in question? Paste line 95 of the script;
..........I have found the problem, just by eye inspection.

That function is by OSC. Should be correct. But it purpose and usage is unclear.
That is where the mistake came from.

Many thanks.