Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Exception thrown without a stack frame in Unknown on line 0
  • I have recently upgraded to 1.5 and I got above error message. Have installed the new Log package and always include it in config... the error was gone, but I still see it from time to time after the page renders on the bottom. See image: https://dl.dropbox.com/u/1207859/fuelphperror.png

    Funny thing is this goes away if I navigate to another page within a site... Then when I navigate back I the message is gone. Then at some it randomly appears again. Very irritating.
  • It's caused by a bug in the autoloader (which has been there since day one), and triggered by the new log package. It's PHP's way of indicating there was an exception while in the exception handler.

    When using 1.5.1, make sure:
    - you have installed the log package
    - you have added the log package to your always_load config section
    - your log folder is writeable by the webserver

    As stated in the changelog.

    We're thinking about releasing a 1.5.2. with a fix for the autoloader, so that you can see the correct exception message instead of this cryptic PHP error.
  • But I have checked and confirmed all three of these.
    - you have installed the log package
    - you have added the log package to your always_load config section
    - your log folder is writeable by the webserver

    All checked, but still getting the error...
  • Get the files autoloader.php and error.php from the 1.5/develop branch of fuel/core, and copy them to your local fuel/core/classes.

    That should fix the problem, in the sense that you will now see the exception that is causing your issue.

    If that works, let me know, we might want to release this as 1.5.2, as more people have these problems.
  • Hi Harro. Yes that helped it made the error go away!
  • 1.5.2. has been released in the meantime to fix this problem.
  • I was being to fast with replying to your solution:


    Get the files autoloader.php and error.php from the 1.5/develop
    branch of fuel/core, and copy them to your local fuel/core/classes.


    First thought it solved my problem of throwing out this error message on bottom of my page, but did not... I will now try 1.5.2  to see if this solves my problem.
  • From 1.6/develop you mean? Those are the same fixes as in 1.5.2.

  • No you said above that I should replace autoloader.php and error.php with the ones from 1.5/develop branch... I did and initially I thought it made the error go away, but later it occurred again. Now I have upgraded to official 1.5.2. release but I still get the error. It's totally random. Sometimes I see it, then I refresh page and its gone... weird.
  • The files from 1.5.2 (1.5/master) and 1.6 are identical.

    If you have it only sometimes, it can't be the Log issue. Go into fuel/core/bootstrap, and disable the error and exception handler (you can't do that if your app relies on exceptions).

    That will cause the normal PHP error to appear in case of issues, perhaps that will give a clue...
  • I don't know whether I have disabled this ok in fuel/core/bootstrap, but what I did is I have commented following lines of code:

    /*
    set_exception_handler(function (\Exception $e)
    {
        // reset the autoloader
        \Autoloader::_reset();

        return \Error::exception_handler($e);
    });*/
    /*
    set_error_handler(function ($severity, $message, $filepath, $line)
    {
        // reset the autoloader
        \Autoloader::_reset();

        return \Error::error_handler($severity, $message, $filepath, $line);
    });
    */

    Still getting the same error message: Fatal error: Exception thrown without a stack frame in Unknown on line 0.

    I usually get this after the site has been idle for a while (no requests on the site). Then I reload the page and this error message appears as shown on this image https://dl.dropbox.com/u/1207859/fuelphperror.png. Then I reload the page again and message is gone. It's frustrating. I use the same core on my other projects and haven't seen this anywhere else...
  • Assuming that you don't have errors or exceptions, you could add a

    var_dump(func_get_args());
    die();

    to each of these closures, and see if that displays something useful?
  • Sam result, same error...
  • If you still have this error when you have disabled the error and exception handlers, you'll have an exception in the shutdown handler.

    These are very hard to find, since PHP is already in it's teardown phase, and exceptions can't be dumped anymore because the call stack is already gone.

    If you don't have events scheduled (through the Event class), the shutdown event is only used by the framework to flush the session.

    Do you use sessions, and if so, which storage backend? Because I assume that's is causing the exception somewhere...
  • Yes I use sessions, DB storage (MySQL).
  • Is this a new application, or one migrated from a previous version of Fuel?

    And if so, can you check if there's an Event call in your index.php? If so, sessions will be created twice, which will cause an exception. This can also explain why you only have it after inactivity, as your session will be expired then, and a new one must be created.
  • Migrated from previous fuel.

    The only 'event' related code in index.php is at the bottom:
    // Fire off the shutdown event
    Event::shutdown();

  • HarroHarro
    Accepted Answer
    Delete that line. Now.

    It should not be there, and it causing your issues. You haven't updated fuel/app when you updated the rest. Always read the changelog, there are usually changes to the app bootstrap and/or index.php when we release a new version.
  • Well hell yes I can see the difference in index.php file... I haven't updated this of-course. I have pulled the latest index.php file and see how behaves but right now I did not get that message.

    Thanks Harro for being patient with me ;)!

    Which brings me to another question: should I check and replace other app-specific files that have been changed with 1.5? Like bootstrap.php and config files?
  • >>It should not be there, and it causing your issues. You haven't updated fuel/app when you updated the rest. Always read the changelog, there are usually changes to the app bootstrap and/or index.php when we release a new version.

    Yes sir, will do next time!
  • Thank you. Would save us both a lot of time... :-)
  • Let me buy you a beer for this :), where's your donate button :)?

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion