Hey!
I sometimes get the following error
<b>Fatal error</b>: Exception thrown without a stack frame in
<b>Unknown</b> on line <b>0</b><br />
What does this mean? Should this ever happen or does it somehow say that
there is a bug in PHP. I am asking this because I've had this error a
few times and it's pretty hard to debug.
Thanks!
- Jakob
I would guess that an exception is getting thrown before you PHP
script has actually started...
Something in the parsing of GET/POST data or file upload handler,
perhaps.
Can you nail down what was being done when it occurred, perhaps by
sending the error to Apache error log, and then looking at previous
line[s] to see what scripts are getting accessed.
Hey!
I sometimes get the following error
<b>Fatal error</b>: Exception thrown without a stack frame in
<b>Unknown</b> on line <b>0</b><br />What does this mean? Should this ever happen or does it somehow say
that
there is a bug in PHP. I am asking this because I've had this error a
few times and it's pretty hard to debug.Thanks!
- Jakob
--
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
Richard Lynch wrote:
I would guess that an exception is getting thrown before you PHP
script has actually started...Something in the parsing of GET/POST data or file upload handler,
perhaps.
Definitely not. I was just testing my Logging class in Zend Studio. So
no input GET/POST data were passed to the script and it's also not a
problem with ZE as I can reproduce it with PHP 5.2.3 on the command line
as well.
Can you nail down what was being done when it occurred, perhaps by
sending the error to Apache error log, and then looking at previous
line[s] to see what scripts are getting accessed.Hey!
I sometimes get the following error
<b>Fatal error</b>: Exception thrown without a stack frame in
<b>Unknown</b> on line <b>0</b><br />What does this mean? Should this ever happen or does it somehow say
that
there is a bug in PHP. I am asking this because I've had this error a
few times and it's pretty hard to debug.Thanks!
- Jakob
--
I am sorry. I can't reproduce the example with a small script. I am
trying hard but I always get a normal error message with a stack trace.
If I can reproduce it, I'll send it to the list.
- Jakob
Okay, I can now reproduce the problem. Here is the code:
<?php
class Foo {
public function __destruct() {
throw new Exception();
}
}
$a = new Foo();
?>
I couldn't reproduce it before as I didn't assign the instance of Foo to
a variable, however Christian Hoffmann pointed me out that I need to do
this in order to get the desired error.
- Jakob
I've run into this before.. essentially, you can't do that ;)
http://us2.php.net/language.oop5.decon (second note)
Nor, can you throw exceptions anytime after the engine starts shutting down.
-ralph
Jakob Buchgraber wrote:
Okay, I can now reproduce the problem. Here is the code:
<?php
class Foo {
public function __destruct() {
throw new Exception();
}
}$a = new Foo();
?>I couldn't reproduce it before as I didn't assign the instance of Foo to
a variable, however Christian Hoffmann pointed me out that I need to do
this in order to get the desired error.
- Jakob
Okay, I can now reproduce the problem. Here is the code:
<?php
class Foo {
public function __destruct() {
throw new Exception();
}
}$a = new Foo();
?>I couldn't reproduce it before as I didn't assign the instance of Foo
to
a variable, however Christian Hoffmann pointed me out that I need to
do
this in order to get the desired error.
The only solution I know of is:
Don't do that.
:-)
Or, accept the fact that your code running in the destructor is
happening outside the realm of time and space as far as PHP is
concerned.
Bascially, anything that goes wrong before PHP starts interpreting
your script (i.e., custom file upload, custom session, custom php.ini
settings extension) and anything that happens after PHP has finished
the last line of your code (session_close function, desctrutors, etc)
is going to have a not-so-informative message about which PHP file /
line caused the problem, or a lack of a stack or whatever, because PHP
is not in a stable state of existence at that point.
Deal with it, or don't do what you're doing are the only real options...
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
I sometimes get the following error
<b>Fatal error</b>: Exception thrown without a stack frame in
<b>Unknown</b> on line <b>0</b><br />What does this mean?
When we see these, they're typically from our custom session handler.
--
Andrew Minerd
Software Architect
The Selling Source, Inc.
On Thu, 28 Jun 2007 22:25:55 +0200
jakob.buchgraber@gmail.com (Jakob Buchgraber) wrote:
Hey!
I sometimes get the following error
<b>Fatal error</b>: Exception thrown without a stack frame in
<b>Unknown</b> on line <b>0</b><br />What does this mean? Should this ever happen or does it somehow say that
there is a bug in PHP. I am asking this because I've had this error a
few times and it's pretty hard to debug.Thanks!
- Jakob
I sometimes get the following error
<b>Fatal error</b>: Exception thrown without a stack frame in
<b>Unknown</b> on line <b>0</b><br />What does this mean?
When we see these, they're typically from our custom session handler.
In my experience that error is almost certainly in a piece of your
code that is run after the main execution of the program is complete.
So places to check are shutdown functions (things registered with
register_shutdown_function()
), custom session handlers and object
destructors. Basically any piece of code that can be called after the
official execution of your script is complete and clean-up is occuring.
Adam Ashley
Adam Ashley wrote:
I sometimes get the following error
<b>Fatal error</b>: Exception thrown without a stack frame in
<b>Unknown</b> on line <b>0</b><br />What does this mean?
When we see these, they're typically from our custom session handler.
In my experience that error is almost certainly in a piece of your code
that is run after the main execution of the program is complete. So
places to check are shutdown functions (things registered with
register_shutdown_function()
), custom session handlers and object
destructors. Basically any piece of code that can be called after the
official execution of your script is complete and clean-up is occuring.Adam Ashley
Yes that's right. This error occured in my Logger class as all the
messages are written into a buffer and when the destructor is called the
data in the buffer are written into a file.
Is that a bad solution? Any alternatives?
Thank you!
Jay
Adam Ashley wrote:
I sometimes get the following error
<b>Fatal error</b>: Exception thrown without a stack frame in
<b>Unknown</b> on line <b>0</b><br />What does this mean?
When we see these, they're typically from our custom session handler.
In my experience that error is almost certainly in a piece of your code
that is run after the main execution of the program is complete. So
places to check are shutdown functions (things registered with
register_shutdown_function()
), custom session handlers and object
destructors. Basically any piece of code that can be called after the
official execution of your script is complete and clean-up is occuring.Adam Ashley
Yes that's right! I am having a Logger class where all log messages are
written into a buffer and when the destructor is called the data are
transformed into some format (e.g. json) and then stored in a file and I
got an exception writing data into the file as I missed the rights.
Is that a bad solution? Any suggestions?
Thank you!
Jakob Buchgraber