exit not working

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Max

    #1

    exit not working

    This either just started happening on PHP 5 or I never noticed the
    errors in the error logs before.

    In an if construct, if a certain condition is present, I want to exit
    the entire script, so after printing something to the screen I issue
    the exit; command. However, in the error logs, it shows that the script
    continues out of the if construct and hits the next line which uses
    list/explode, but this causes errors because the variables are not
    available.

    The bottom line is why does the script continue after exit? I've even
    taken the exit command out of the if construct and put it directly
    above the list/explode statement, so that regardless of any condition
    the script should end...yet it still continues.

    I've tried exit;, exit();, and die(); all with the same results.

    Anyone have any ideas how to get around this?

    Thanks,
    Max

  • Good Man

    #2
    Re: exit not working

    "Max" <max@kipness.co mwrote in news:1156863358 .075644.44180
    @m79g2000cwm.go oglegroups.com:
    I've tried exit;, exit();, and die(); all with the same results.
    i had similar trouble on a shared hosting server - script continuing when i
    clearly told it to exit.

    i think it involves something with either safe_mode being enabled, output
    buffering being enabled, or error_reporting being enabled.

    it makes debugging sheer hell. someone else can probably tell you what it
    is specifically, but i encountered this problem last week (on PHP 4 btw).

    good luck

    Comment

    • Juliette

      #3
      Re: exit not working

      Good Man wrote:
      "Max" <max@kipness.co mwrote in news:1156863358 .075644.44180
      @m79g2000cwm.go oglegroups.com:
      >
      >I've tried exit;, exit();, and die(); all with the same results.
      >
      i had similar trouble on a shared hosting server - script continuing when i
      clearly told it to exit.
      >
      i think it involves something with either safe_mode being enabled, output
      buffering being enabled, or error_reporting being enabled.
      >
      it makes debugging sheer hell. someone else can probably tell you what it
      is specifically, but i encountered this problem last week (on PHP 4 btw).
      >
      good luck

      Have a look at trigger_error:



      I nowadays use something along the lines of the below if I want a hard
      exit (and depending on your error level settings this can be shown to
      the user / logged or you can use set_error_handl er to specify a totally
      different action:

      trigger_error(' error message', E_USER_ERROR );

      Comment

      Working...