473,388 Members | 1,423 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Stack backtrace on fatal error?

I'm getting fatal errors when executing code - and my error handler is
failing to trap them - so I get no stack backtrace :-(

The error I am getting is:

"Fatal error: Call to a member function fetchRow() on a non-object."

What are the available options here?

Am I supposed to check I have a real object whenever I perform
a method call - or run the risk of getting runtime errors which
give few clues about where the functions they are in are being
called from?

Is there some way of beefing up the error handler so that
"fatal errors" can be trapped - without using a customised
PHP parser at runtime?
--
__________
|im |yler http://timtyler.org/ ti*@tt1lock.org Remove lock to reply.
Jul 17 '05 #1
8 9969
On Fri, 17 Sep 2004 12:11:04 GMT, Tim Tyler <ti*@tt1lock.org> wrote:
I'm getting fatal errors when executing code - and my error handler is
failing to trap them - so I get no stack backtrace :-(

The error I am getting is:

"Fatal error: Call to a member function fetchRow() on a non-object."


Looks like a bug to me, this ought to go to the user defined error handler.
Have you checked bugs.php.net?

Attempts to get a property of a non-object goes through the user defined error
handler from a quick test, but not method calls.

--
Andy Hassall / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Jul 17 '05 #2
Andy Hassall <an**@andyh.co.uk> wrote or quoted:
On Fri, 17 Sep 2004 12:11:04 GMT, Tim Tyler <ti*@tt1lock.org> wrote:

I'm getting fatal errors when executing code - and my error handler is
failing to trap them - so I get no stack backtrace :-(

The error I am getting is:

"Fatal error: Call to a member function fetchRow() on a non-object."


Looks like a bug to me, this ought to go to the user defined error handler.
Have you checked bugs.php.net?


There they say that thay can't continue from fatal errors - because
the Zend engine has got its knickers in a twist by that stage -
but they /do/ also say:

``Fatal errors are fatal for a reason although there are some feature
change requests to separate out Zend fatals (which will never be
catchable) and PHP Fatal errors which maybe oneday we can make
catchable.''

- http://bugs.php.net/bug.php?id=9384

Another supposedly-fatal error: "Call to undefined function" :-(
--
__________
|im |yler http://timtyler.org/ ti*@tt1lock.org Remove lock to reply.
Jul 17 '05 #3
Tim Tyler <ti*@tt1lock.org> wrote in message news:<I4********@bath.ac.uk>...
<snip>
Is there some way of beefing up the error handler so that
"fatal errors" can be trapped - without using a customised
PHP parser at runtime?


Custom error handler cannot handle the fatal errors; you need to do
the output buffering techniques. Look at the manual and user note
<http://in.php.net/set_error_handler#35622> When you use output
buffering, you cannot again use highlight_string(). I have written a
custom error handler to handle all these situations; as it is
proprietary, I cannot outsource it now.

HTH.

--
| Just another PHP saint |
Email: rrjanbiah-at-Y!com
Jul 17 '05 #4
R. Rajesh Jeba Anbiah <ng**********@rediffmail.com> wrote or quoted:
Tim Tyler <ti*@tt1lock.org> wrote in message news:<I4********@bath.ac.uk>...

Is there some way of beefing up the error handler so that
"fatal errors" can be trapped - without using a customised
PHP parser at runtime?


Custom error handler cannot handle the fatal errors; you need to do
the output buffering techniques. Look at the manual and user note
<http://in.php.net/set_error_handler#35622> When you use output
buffering, you cannot again use highlight_string(). I have written a
custom error handler to handle all these situations; as it is
proprietary, I cannot outsource it now.


Interesting - thanks.

Unfortunately, calling debug_backtrace() within the fatal error handler
seems to produce one function call - to the fatal error handler itself -
so this approach does not seem effective at getting hold of backtrace
information for the fatal error - and getting hold of that information
was the main reason I was interested in trapping the error in the first
place.
--
__________
|im |yler http://timtyler.org/ ti*@tt1lock.org Remove lock to reply.
Jul 17 '05 #5
Tim Tyler wrote:
"Fatal error: Call to a member function fetchRow() on a non-object."


It means that you've done eg $foo->fetchRow() but $foo is not actually an
object. Without seeing any of your code it is difficult to further diagnose
what your problem is.

--
Chris Hope - The Electric Toolbox - http://www.electrictoolbox.com/
Jul 17 '05 #6
Chris Hope <bl*******@electrictoolbox.com> wrote or quoted:
Tim Tyler wrote:

"Fatal error: Call to a member function fetchRow() on a non-object."


It means that you've done eg $foo->fetchRow() but $foo is not actually an
object. Without seeing any of your code it is difficult to further diagnose
what your problem is.


I was not trying to fix that problem - it was an example.

I was trying to find a better way of fixing *all* such bugs -
by getting PHP to report where the problem code was called from.
--
__________
|im |yler http://timtyler.org/ ti*@tt1lock.org Remove lock to reply.
Jul 17 '05 #7
R. Rajesh Jeba Anbiah <ng**********@rediffmail.com> wrote or quoted:
Tim Tyler <ti*@tt1lock.org> wrote in message news:<I4********@bath.ac.uk>...

Unfortunately, calling debug_backtrace() within the fatal error handler
seems to produce one function call - to the fatal error handler itself -
so this approach does not seem effective at getting hold of backtrace
information for the fatal error - and getting hold of that information
was the main reason I was interested in trapping the error in the first
place.


For me, it is working (4.3.4).


Hmm. I may try again someday.

It's a "dreadful hack" - but it /would/ be helpful if I could get it to work.
--
__________
|im |yler http://timtyler.org/ ti*@tt1lock.org Remove lock to reply.
Jul 17 '05 #8
Tim Tyler <ti*@tt1lock.org> wrote in message news:<I4********@bath.ac.uk>...
R. Rajesh Jeba Anbiah <ng**********@rediffmail.com> wrote or quoted:
Unfortunately, calling debug_backtrace() within the fatal error handler
seems to produce one function call - to the fatal error handler itself -
so this approach does not seem effective at getting hold of backtrace
information for the fatal error - and getting hold of that information
was the main reason I was interested in trapping the error in the first
place.


For me, it is working (4.3.4).


Hmm. I may try again someday.

It's a "dreadful hack" - but it /would/ be helpful if I could get it to work.


There is a popular ErrorHandler class
<http://www.phpclasses.org/ErrorHandler>. Unfortunately, it didn't
attract me much, probably it may be useful to you. They trap so many
errors with additional JS.

--
| Just another PHP saint |
Email: rrjanbiah-at-Y!com
Jul 17 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: dsclements | last post by:
>Description: I'm running mysql in a 3 server configuration, with 2 servers being slaves to the first. I'm running vpopmail, which means a connection every incoming mail and every check. I woke up...
2
by: David N. | last post by:
My small C# application, running on a Windows 2003 server machine with 512 RAM and 80 gigabytes of diskspace, always bombs out with the following error: >> Fatal stack overfollow error. ...
4
by: Jesper Stocholm | last post by:
I have a recursive function that I would like to do a lot of recursive calls (preferebly 2^20 in total) The function is called as (with maxi = e.g. 100000) DoRecursion(0,maxi,bseed,sha); ...
5
by: Don Kim | last post by:
I copied this example off ECMA C++/CLI draft document, and it doesn't compile: #using <mscorlib.dll> using namespace System; public ref class Stack { public: Stack() { first = nullptr;
1
by: R | last post by:
Hi All, I'm using PHP 5, my code fully separates code from content, my code throws exceptions (LIZException) when error occurs. but every time I throw exception I get this fatal error: ...
1
by: steele20 | last post by:
hello I am getting this strange error Linking... Cpp2.obj : error LNK2001: unresolved external symbol "public: bool __thiscall Stack::push(char const &)" (?push@Stack@@QAE_NABD@Z) Debug/Cpp2.exe...
3
by: samirbhalerao | last post by:
Hi everybody, i have recieved an error as stack backtrace erro code is 0x50012b8 i am getting this error while booting the system. Error in the screen appears as follows.
5
by: jodelson | last post by:
Hello all! I am sorry my first post here is a question. I hope to contribute during the posting and replies on this thread. I am stuck for 1 week in a *** stack smashing detected *** bug in my...
2
by: Sven | last post by:
Hello, I have a crashing application and tried to find out what is going wrong. So I run this application with the gdb debugger. I found the position of the crash in a function which searches...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.