Results 1 to 4 of 4
  1. #1
    Join Date
    May 2009

    PHP error oddity

    Can anyone explain this behavior?

    I have an error handling function defined that dumps $errno and $errstr, however, if I execute the following:

    PHP Code:
    I get this:

    2, include(1) [function.include]: failed to open stream: No such file or directory
    2, include() [function.include]: Failed opening '1' for inclusion (include_path='.:/php-inc:/lib/php')
    2, require(1) [function.require]: failed to open stream: No such file or directory
    Fatal error:  require() [function.require]: Failed opening required '1' (include_path='.:/php-inc:/lib/php') in /path/to/index.php on line 44
    It looks like require() throws a warning and an error, and for some reason, my error handling function is not picking up the E_ERROR and handling it gracefully...

  2. #2
    Join Date
    May 2009
    Please disregard...rookie mistake. For those interested, set_error_handler() will not work on fatal errors. The workaround is setting error_reporting(0) (to suppress the default PHP browser output) and using register_shutdown_function("yourFatalErrorHandler").

    In yourFatalErrorHandler(), you can grab the last error with error_get_last(), and then do whatever.

    Lesson learned: RTFM, so please if you don't have 10+ years experience like me and someone tells you to RTFM, please don't pitch a fit...happens to us too.

  3. #3
    Join Date
    May 2008
    Rutherford, NJ
    Yep, I've been doing this full time for years, and still find myself referencing things. Experience means you know how to use the features well, it's not about memorizing every last thing. I like to RTFM.
    Database design and performance optimization, custom PHP scripts, and publicly available resources for developers!

  4. #4
    Join Date
    Nov 2005
    If everyone would rtfm, coding forums would lose 71.9% (according to my slide rule) of their php questions and replies. That would translate into the loss of a lot of ad views.

Similar Threads

  1. IMG tag oddity
    By SharkBait in forum Web Design and Content
    Replies: 9
    Last Post: 04-03-2006, 08:40 PM
  2. phpbb oddity...
    By VolkNet in forum Web Hosting Lounge
    Replies: 11
    Last Post: 06-16-2005, 03:20 PM
  3. IP Oddity
    By ChrisTech in forum Web Hosting Lounge
    Replies: 2
    Last Post: 06-13-2005, 08:30 PM
  4. Oddity...
    By axe9 in forum Web Design and Content
    Replies: 12
    Last Post: 01-04-2005, 08:20 PM
  5. ASP oddity
    By netastic in forum Dedicated Server
    Replies: 1
    Last Post: 09-16-2001, 01:29 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts