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.
who called this function?
Moderator: General Moderators
- social_experiment
- DevNet Master
- Posts: 2793
- Joined: Sun Feb 15, 2009 11:08 am
- Location: .za
Re: who called this function?
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
Re: who called this function?
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.
- social_experiment
- DevNet Master
- Posts: 2793
- Joined: Sun Feb 15, 2009 11:08 am
- Location: .za
Re: who called this function?
How is the variable 'query' created? Is it returned from the function in question? Paste line 95 of the script;wvoyance wrote:But I don't think it is useful. I know it is wrong at line95, and I know it is empty.
“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
Re: who called this function?
..........I have found the problem, just by eye inspection.social_experiment wrote:How is the variable 'query' created? Is it returned from the function in question? Paste line 95 of the script;wvoyance wrote:But I don't think it is useful. I know it is wrong at line95, and I know it is empty.
That function is by OSC. Should be correct. But it purpose and usage is unclear.
That is where the mistake came from.
Many thanks.