who called this function?

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
User avatar
wvoyance
Forum Contributor
Posts: 135
Joined: Tue Apr 17, 2012 8:24 pm

who called this function?

Post 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.
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: who called this function?

Post 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
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
User avatar
wvoyance
Forum Contributor
Posts: 135
Joined: Tue Apr 17, 2012 8:24 pm

Re: who called this function?

Post 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.
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: who called this function?

Post 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;
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
User avatar
wvoyance
Forum Contributor
Posts: 135
Joined: Tue Apr 17, 2012 8:24 pm

Re: who called this function?

Post 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.
Post Reply