473,785 Members | 2,325 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to stop code execution when an error is found on a function, fromwithin the function... It's hard to explain, just read...

index.php
---
inlcude 'application.ph p';
functions.php
---
function test1() {
trigger_error(' My error');
return FALSE;
}
application.php
---
eval('
//code...
test1();
//code...
');

What I want is to stop the eval as soon as test1() errors, without
having to do ifs on the eval'd code. Is there any chance, or do I
really have to do:

eval('
//code...
if (test1()) {

} else {
return;
}
//code...
');

What's the code I should use on test1()? Because I can't control the
eval'd code (because it's written by other developers), but I can
control test1() and index.php, and I want test1() to stop the eval'd
code so index.php can continue working (cleaning the output buffer of
the eval'd code and outputting an error message). Is there any chance
of doing that?
Jan 14 '08 #1
2 2749
On Jan 14, 11:02 am, Bruno Rafael Moreira de Barros
<brunormbar...@ gmail.comwrote:
index.php
---
inlcude 'application.ph p';

functions.php
---
function test1() {
trigger_error(' My error');
return FALSE;

}

application.php
---
eval('
//code...
test1();
//code...
');

What I want is to stop the eval as soon as test1() errors, without
having to do ifs on the eval'd code. Is there any chance, or do I
really have to do:

eval('
//code...
if (test1()) {

} else {
return;
}

//code...
');

What's the code I should use on test1()? Because I can't control the
eval'd code (because it's written by other developers), but I can
control test1() and index.php, and I want test1() to stop the eval'd
code so index.php can continue working (cleaning the output buffer of
the eval'd code and outputting an error message). Is there any chance
of doing that?
Exceptions will probably do the trick. The other post I have made has
actually solved the problem with this one as well. Thanks anyway.
Jan 14 '08 #2

"Bruno Rafael Moreira de Barros" <br***********@ gmail.comwrote in message
news:8d******** *************** ***********@q39 g2000hsf.google groups.com...
index.php
---
inlcude 'application.ph p';
functions.php
---
function test1() {
trigger_error(' My error');
return FALSE;
}
application.php
---
eval('
//code...
test1();
//code...
');

What I want is to stop the eval as soon as test1() errors, without
having to do ifs on the eval'd code. Is there any chance, or do I
really have to do:

eval('
//code...
if (test1()) {

} else {
return;
}
//code...
');

What's the code I should use on test1()? Because I can't control the
eval'd code (because it's written by other developers), but I can
control test1() and index.php, and I want test1() to stop the eval'd
code so index.php can continue working (cleaning the output buffer of
the eval'd code and outputting an error message). Is there any chance
of doing that?
check the manual on "continue;" .

Jan 15 '08 #3

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

Similar topics

51
5291
by: Mudge | last post by:
Please, someone, tell me why OO in PHP is better than procedural.
15
2598
by: Ralf W. Grosse-Kunstleve | last post by:
****************************************************************************** This posting is also available in HTML format: http://cci.lbl.gov/~rwgk/python/adopt_init_args_2005_07_02.html ****************************************************************************** Hi fellow Python coders, I often find myself writing:: class grouping:
25
2351
by: Delta | last post by:
Drop Down Menu Mozilla : work well widowed elements such as drop downs, except for flash movies IE : work well so far http://pwp.netcabo.pt/falmartins/index.htm
1
4010
by: Daveyk0 | last post by:
Hello there, I have a front end database that I have recently made very many changes to to allow off-line use. I keep copies of the databases on my hard drive and link to them rather than the live databases on the network. Is there a way, via code, when I get back in-house from being on the road to click a button, and select the backends I want to link to? I would want to delete all the current links and link to the "live"
6
2347
by: TPJ | last post by:
Help me please, because I really don't get it. I think it's some stupid mistake I make, but I just can't find it. I have been thinking about it for three days so far and I still haven't found any solution. My code can be downloaded from here: http://www.tprimke.net/konto/PyObject-problem.tar.bz2. There are some scripts for GNU/Linux system (bash to be precise). All you need to know is that there are four classes. (Of course, you may...
16
2820
by: Rex | last post by:
Hi All - I have a question that I think MIGHT be of interest to a number of us developers. I am somewhat new to VIsual Studio 2005 but not new to VB. I am looking for ideas about quick and efficient navigating within Visual Studio 2005. Let's say your project (or solution) has dozens of forms and hundreds or even thousands of routines. Two Questions: 1) BUILT-IN to Visual Studio 2005. What ideas do you have to quickly
232
13349
by: robert maas, see http://tinyurl.com/uh3t | last post by:
I'm working on examples of programming in several languages, all (except PHP) running under CGI so that I can show both the source files and the actually running of the examples online. The first set of examples, after decoding the HTML FORM contents, merely verifies the text within a field to make sure it is a valid representation of an integer, without any junk thrown in, i.e. it must satisfy the regular expression: ^ *?+ *$ If the...
0
3534
by: fischermx | last post by:
Environment: Microsoft Visual Studio 2005 Version 8.0.50727.762 (SP.050727-7600) Microsoft .NET Framework Version 2.0.50727 Microsoft Visual Studio 2005 Professional Edition - ENU Service Pack 1 (KB926601) Hotfix for Microsoft Visual Studio 2005 Professional Edition - ENU (KB933608) Windows XP, SP2.
4
28746
by: Ralphz | last post by:
Hi How do I stop JavaScript execution when I encounter an error? Is there something similar to PHP's exit or die function? Thanks Ralph
0
9645
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9481
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10341
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10155
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7502
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6741
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5383
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5513
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2881
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.