473,503 Members | 1,646 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

exit not working

Max
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

Aug 29 '06 #1
2 5526
"Max" <ma*@kipness.comwrote in news:1156863358.075644.44180
@m79g2000cwm.googlegroups.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
Aug 29 '06 #2
Good Man wrote:
"Max" <ma*@kipness.comwrote in news:1156863358.075644.44180
@m79g2000cwm.googlegroups.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:
http://nl3.php.net/manual/en/function.trigger-error.php
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_handler to specify a totally
different action:

trigger_error('error message', E_USER_ERROR );
Aug 29 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
3109
by: deko | last post by:
I have a function with a number of long loops. While the function is running, I want to be able to click a Stop button and exit the function as quickly as possible. The abbreviated code looks...
6
20036
by: orekin | last post by:
Hi There I have been trying to come to grips with Application.Run(), Application.Exit() and the Message Pump and I would really appreciate some feedback on the following questions .. There are...
1
2486
by: Peter Oliphant | last post by:
I have a C++ Console application being written using VS C++.NET 2005 Express. It never crashes and seems to be working just fine. However, when I close the application via the Console 'X' exit...
19
11458
by: ern | last post by:
Right now I'm using exit(0) to terminate my program. My program is a console .exe application. After the "exit(0)" line of code is encountered, the console application waits for an enter press,...
1
3096
by: Pete | last post by:
Hi All, I'm new to this so please correct me if I'm wrong. I have written a small program which holds details for task information. the program holds an email address, i created a button which...
3
2495
by: Rudi | last post by:
Hello, following problem: At program end or release an assembly a serial device should get a final exit sequence. How can I do this? With Dispose() it's no problem, but this assembly is used...
4
6170
by: Quill_Patricia | last post by:
I have a Python script which is used to load data into a database. Up to now this script has been run by customers from the Windows command prompt using "python edg_loader.pyc". Any error messages...
39
2770
by: mathieu | last post by:
Hi there, I am trying to reuse a piece of code that was designed as an application. The code is covered with 'exit' calls. I would like to reuse it as a library. For that I renamed the 'main'...
5
3165
by: lemlimlee | last post by:
hello, this is the task i need to do: For this task, you are to develop a Java program that allows a user to search or sort an array of numbers using an algorithm that the user chooses. The...
0
7198
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7319
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6979
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5570
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3160
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
373
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.