Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
What might cause an “ErrorException [ Error ]: Class 'Error' not found”?
  • We have two sets of ORM models that we’re trying to query.  They’re nearly identical in function and form, but only one of them causes an “ErrorException [ Error ]: Class 'Error' not found” to pop up when we try to build a query from them in a controller.  It doesn’t occur when calling ->get(), just when asking for a query object at all (e.g., Model_Fu::query()).  And it doesn’t even happen in all cases.

    We’ve been using this same code for months, and when making almost a duplicate of it in Model_Fu (and one related model), it has broken.  They both extend the same class (just Model with a few helper functions).

    The stack trace traces it to the bottom of our Model_Fu file like it’s trying to look for the Error class in Model_Fu’s file.  Looking into the source of some ORM classes that we thought might host the problem, we found everywhere that they were throwing \Error (in the global namespace), so why it was having trouble finding the \Error really puzzled us.  So, does anyone know what kinds of things might cause that kind of error to be thrown?  Are we missing something obvious?

  • HarroHarro
    Accepted Answer
    Sometimes when in the error handler the PHP autoloader refuses to work. It's a bug in specific PHP versions.

    Which Fuel version are you using? We've tried to find some workarounds for this issue, not sure if they are in 1.7.1 or i 1.8/develop (which will become 1.7.2. next week). If you're not on the latest version, I suggest you upgrade and see if that helps?

    Problem is you have an error elsewhere, but it's supressed because of the new "Error not found" error.
  • Oh, gosh, I guess we're still using 1.6.1, so I'll try upgrading today and see if it will show me a better error. Thanks for the tip!
  • It works! It totally works! It didn't just show me a better error report; it fixed all my problems. I'm finally reunited with my long lost twin, and my daddy issues are all resolved, and I'm not allergic to strawberries anymore. Oh frabjous day! Thanks, Harro!  Thanks Fuel Team!
  • :-)

    Glad to be of help, happy coding!

Howdy, Stranger!

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

In this Discussion