[PHP] Exception Handling

2012-06-01 Thread James Colannino
Hey guys, Haven't posted in a long time... Happy Memorial Day! I have an issue with exception handling. I'm using a framework that throws a Database_Exception object. I was expecting catch (Exception $var) to be sufficient to catch this, but it doesn't. I have to do catch

Re: [PHP] Exception Handling

2012-06-01 Thread ma...@behnke.biz
James Colannino crankycycl...@gmail.com hat am 1. Juni 2012 um 16:25 geschrieben: Hey guys, Haven't posted in a long time... Happy Memorial Day! I have an issue with exception handling. I'm using a framework that throws a Database_Exception object. I was expecting catch (Exception $var)

RE: [PHP] Exception Handling

2012-06-01 Thread Mackintosh, Mike
-Original Message- From: James Colannino [mailto:crankycycl...@gmail.com] Sent: Friday, June 01, 2012 10:25 AM To: PHP-General List Subject: [PHP] Exception Handling Hey guys, Haven't posted in a long time... Happy Memorial Day! I have an issue with exception handling. I'm using

Re: [PHP] Exception Handling

2012-06-01 Thread James Colannino
On 06/01/12 07:30, ma...@behnke.biz wrote: James Colanninocrankycycl...@gmail.com hat am 1. Juni 2012 um 16:25 geschrieben: Hey guys, Haven't posted in a long time... Happy Memorial Day! I have an issue with exception handling. I'm using a framework that throws a Database_Exception object.

Re: [PHP] Exception Handling

2012-06-01 Thread James Colannino
On 06/01/12 08:08, James Colannino wrote: On 06/01/12 07:30, ma...@behnke.biz wrote: James Colanninocrankycycl...@gmail.com hat am 1. Juni 2012 um 16:25 geschrieben: Hey guys, Haven't posted in a long time... Happy Memorial Day! I have an issue with exception handling. I'm using a

Re: [PHP] Exception Handling

2012-06-01 Thread James Colannino
On 06/01/12 07:32, Mackintosh, Mike wrote: Hi James, You would have to catch Database_Exception. It is also good practice to also always catch exception afterwards. Hey Mike, Thanks for the reply! I saw this comment in the documentation

RE: [PHP] Exception Handling

2012-06-01 Thread Mackintosh, Mike
-Original Message- From: James Colannino [mailto:crankycycl...@gmail.com] Sent: Friday, June 01, 2012 11:14 AM To: PHP-General List Subject: Re: [PHP] Exception Handling Hey Mike, Thanks for the reply! I saw this comment in the documentation (http://www.php.net/manual/en

Re: [PHP] Exception Handling

2012-06-01 Thread FeIn
Maybe catch(Exception $e) should be catch(\Exception $e)? On Fri, Jun 1, 2012 at 5:25 PM, James Colannino crankycycl...@gmail.com wrote: Hey guys, Haven't posted in a long time...  Happy Memorial Day!  I have an issue with exception handling.  I'm using a framework that throws a

Re: [PHP] Exception Handling

2012-06-01 Thread Marco Behnke
Am 01.06.12 17:08, schrieb James Colannino: Hey Marco, Thanks for the reply! That was the first thing I checked. class Database_Exception extends \FuelException {} class Fuel_Exception extends \Exception {} It's extending Exception, as expected. Also, can you throw classes that don't

Re: [PHP] Exception Handling

2012-06-01 Thread James Colannino
On Fri, Jun 1, 2012 at 12:51 PM, Marco Behnke ma...@behnke.biz wrote: Ah, I guess that is the problem. Your application framework uses namespaces. I guess you should try catch (\Exception $e) instead of catch (Exception $e) :-) Ah, that was probably it. Will try it out tonight to

[PHP] exception throw from __autoload could not be catched on php 5.3.1

2010-01-28 Thread Eric Lee
Hi php-dev pros, I got an issue about catching exception throw from __autoload on php 5.3.1. The manual state that exception throw from __autoload could be catched with try.. catch statement same as the normal flow. But I'can archive that even I have copied the same sample code from the manual.

Re: [PHP] exception throw from __autoload could not be catched on php 5.3.1

2010-01-28 Thread Ashley Sheridan
On Fri, 2010-01-29 at 13:02 +0800, Eric Lee wrote: Hi php-dev pros, I got an issue about catching exception throw from __autoload on php 5.3.1. The manual state that exception throw from __autoload could be catched with try.. catch statement same as the normal flow. But I'can archive

Re: [PHP] exception throw from __autoload could not be catched on php 5.3.1

2010-01-28 Thread Ashley Sheridan
On Fri, 2010-01-29 at 13:02 +0800, Eric Lee wrote: Hi php-dev pros, I got an issue about catching exception throw from __autoload on php 5.3.1. The manual state that exception throw from __autoload could be catched with try.. catch statement same as the normal flow. But I'can archive

Re: [PHP] exception throw from __autoload could not be catched on php 5.3.1

2010-01-28 Thread Ryan
于 2010-1-29 13:19, Ashley Sheridan 写道: On Fri, 2010-01-29 at 13:02 +0800, Eric Lee wrote: Hi php-dev pros, I got an issue about catching exception throw from __autoload on php 5.3.1. The manual state that exception throw from __autoload could be catched with try.. catch statement same

Re: [PHP] exception throw from __autoload could not be catched on php 5.3.1

2010-01-28 Thread Eric Lee
On Fri, Jan 29, 2010 at 1:19 PM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: On Fri, 2010-01-29 at 13:02 +0800, Eric Lee wrote: Hi php-dev pros, I got an issue about catching exception throw from __autoload on php 5.3.1. The manual state that exception throw from __autoload could be

Re: [PHP] exception throw from __autoload could not be catched on php 5.3.1

2010-01-28 Thread Eric Lee
Hi all and thanks for Ryan, I apologize ! ! I have missed out the small class_exists call before it. Thanks. Regards, Eric, 2010/1/29 Ryan ryansu...@gmail.com 于 2010-1-29 13:19, Ashley Sheridan 写道: On Fri, 2010-01-29 at 13:02 +0800, Eric Lee wrote: Hi php-dev pros, I got an

Re: [PHP] Re: php exception handling

2009-10-12 Thread kranthi
cant http://us3.php.net/manual/en/function.set-exception-handler.php be used ? ?php function exception_handler($e) { //mail('to', 'exception', $e-getMessage()); } set_exception_handler('exception_handler'); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

[PHP] php exception handling

2009-10-11 Thread Lars Nielsen
Hi, I am trying to make an exception class that emails the errors to myself. I have started by using the example by ask at nilpo dot com on http://dk2.php.net/manual/en/language.exceptions.php. It work ok but i want it NOT to show the errors on the php-page but only show the details in the email

Re: [PHP] php exception handling

2009-10-11 Thread Tommy Pham
- Original Message From: Lars Nielsen l...@mit-web.dk To: php-general@lists.php.net Sent: Sun, October 11, 2009 2:18:03 PM Subject: [PHP] php exception handling Hi, I am trying to make an exception class that emails the errors to myself. I have started by using the example

Re: [PHP] php exception handling

2009-10-11 Thread Larry Garfield
On Sunday 11 October 2009 6:09:46 pm Tommy Pham wrote: Lars, Here's a pseudo code: try { if (!$valid) { throw new Exception(Test failed.); } else { // do something } } catch (Exception $e) { // set/print a user friendly message to send to output // set a detailed

[PHP] Re: php exception handling

2009-10-11 Thread Al
Lars Nielsen wrote: Hi, I am trying to make an exception class that emails the errors to myself. I have started by using the example by ask at nilpo dot com on http://dk2.php.net/manual/en/language.exceptions.php. It work ok but i want it NOT to show the errors on the php-page but only show

Re: [PHP] Exception not being caught

2009-07-16 Thread David Otton
2009/7/15 Weston C west...@gmail.com: ?php class A { } $a = new A();                           // Ayn would be proud, right? try {    echo a is ,$a,\n; } catch(Exception $e) {    echo \nException Caught: ;    echo $e, $n; } ? This does not run as expected. I'd think that when the

Re: [PHP] Exception not being caught

2009-07-16 Thread Martin Scotta
There are many examples of error_handlers at http://ar.php.net/manual/es/function.set-error-handler.php The handler only have to cast the error to exception. YOu can write a simple handler or a fully featured one, but the essence is the same... function errorHandler(/*args*/) { $e = new

[PHP] Exception not being caught

2009-07-15 Thread Weston C
So, I've got a little piece of code designed to play with catching the exception that's thrown when an object doesn't have a __toString method. ?php class A { } $a = new A(); // Ayn would be proud, right? try { echo a is ,$a,\n; } catch(Exception $e) { echo

[PHP] Exception vs exception

2008-02-21 Thread Prabath Kumarasinghe
Hi All Recently I'm came across following code snippet regarding exceptions there I'm executing invalid query and catch the exception as follows. First Approach --- try{ $result = mysql_query('SELECT * from unknowntable'); }catch(exception $e){ echo

Re: [PHP] Exception vs exception

2008-02-21 Thread Chris
Prabath Kumarasinghe wrote: Hi All Recently I'm came across following code snippet regarding exceptions there I'm executing invalid query and catch the exception as follows. First Approach --- try{ $result = mysql_query('SELECT * from unknowntable');

RE: [PHP] Exception vs exception

2008-02-21 Thread Andrés Robinet
-Original Message- From: Prabath Kumarasinghe [mailto:[EMAIL PROTECTED] Sent: Thursday, February 21, 2008 11:19 PM To: php-general@lists.php.net Subject: [PHP] Exception vs exception Hi All Recently I'm came across following code snippet regarding exceptions there I'm executing

Re: [PHP] Exception vs exception

2008-02-21 Thread Prabath Kumarasinghe
--- Chris [EMAIL PROTECTED] wrote: Prabath Kumarasinghe wrote: Hi All Recently I'm came across following code snippet regarding exceptions there I'm executing invalid query and catch the exception as follows. First Approach --- try{

Re: [PHP] Exception vs exception

2008-02-21 Thread Paul Scott
On Thu, 2008-02-21 at 21:01 -0800, Prabath Kumarasinghe wrote: In second approach for every query I have to write throw new MySQLException(My Message). It's very time consuming isn't it? In order to *be* lazy, you have to *think* lazy... Don't go and define every single query with an

Re: [PHP] Exception vs exception

2008-02-21 Thread Chris
But it's give a many information using $e-getTrace() is this correct. If there are several mysql_query then I can put it as bunch within try block and catch exception easily. No, it doesn't give any such information. 1 :?php 2 :mysql_connect('server', 'username', 'password'); 3

Re: [PHP] Exception handling with file()

2008-02-14 Thread Richard Lynch
On Mon, February 11, 2008 6:34 am, John Papas wrote: I need to open a remote file with file() and I would like to put it inside a try-catch but as far as I can tell file() does not raise an exception if it fails. The following code: try { $data =

[PHP] Exception handling with file()

2008-02-11 Thread John Papas
I need to open a remote file with file() and I would like to put it inside a try-catch but as far as I can tell file() does not raise an exception if it fails. The following code: try { $data = file('http://myserver.com/myfile.txt'); $date = substr($data, 0);

Re: [PHP] Exception handling with file()

2008-02-11 Thread Zoltán Németh
2008. 02. 11, hétfő keltezéssel 14.34-kor John Papas ezt írta: I need to open a remote file with file() and I would like to put it inside a try-catch but as far as I can tell file() does not raise an exception if it fails. The following code: try { $data =

Re: [PHP] Exception handling in PHP

2008-02-07 Thread Paul Scott
On Wed, 2008-02-06 at 23:37 -0800, Prabath Kumarasinghe wrote: Does that mean for every exception do we have to write our custom exception and describe it from our own message No, it means that when you want to throw a meaningful exception, you need to type in a message. I mentioned custom

Re: [PHP] Exception handling in PHP

2008-02-07 Thread Prabath Kumarasinghe
Understood, Thanks Paul Cheers Prabath --- Paul Scott [EMAIL PROTECTED] wrote: On Wed, 2008-02-06 at 23:37 -0800, Prabath Kumarasinghe wrote: Does that mean for every exception do we have to write our custom exception and describe it from our own message No, it means that when

Re: [PHP] Exception handling in PHP

2008-02-07 Thread Paul Scott
On Thu, 2008-02-07 at 00:20 -0800, Prabath Kumarasinghe wrote: Understood, Thanks Paul Pleasure, but please don't top post, it makes it really hard to follow a thread easily. Most people on this list take time out from their really busy day jobs to help out, and the more time that everyone

Re: [PHP] Exception handling in PHP

2008-02-07 Thread Richard Heyes
Does that mean for every exception do we have to write our custom exception and describe it from our own message If you mean Do I have to write custom exception classes?, the no. You could just use the PHP Exception class. Eg. class DBException extends Exception {} try { $connection

Re: [PHP] Exception handling in PHP

2008-02-07 Thread Richard Heyes
// ... That's from memory, so there may be a few errors. Seems there was. Try this: class DBException extends Exception {} try { $connection = mysql_connect(...); if (!$connection) { throw new DBException('Failed to connect to database'); } // Database exception

[PHP] Exception handling in PHP

2008-02-06 Thread Prabath Kumarasinghe
Hi All I'm little bit confusing with PHP exception handling. Could you able to explain how to put try{} and catch(){} in a proper way in PHP. I had already read php exception manual but it didn't help me to get exact idea about exception handling in php. Cheers Prabath

Re: [PHP] Exception handling in PHP

2008-02-06 Thread Paul Scott
On Wed, 2008-02-06 at 22:52 -0800, Prabath Kumarasinghe wrote: Hi All I'm little bit confusing with PHP exception handling. Could you able to explain how to put try{} and catch(){} in a proper way in PHP. I had already read php exception manual but it didn't help me to get exact idea

Re: [PHP] Exception handling in PHP

2008-02-06 Thread Prabath Kumarasinghe
I'm little bit confusing with PHP exception handling. Could you able to explain how to put try{} and catch(){} in a proper way in PHP. I had already read php exception manual but it didn't help me to get exact idea about exception handling in php. Well, its pretty simple really

Re: [PHP] Exception handling in PHP

2008-02-06 Thread Paul Scott
On Wed, 2008-02-06 at 23:10 -0800, Prabath Kumarasinghe wrote: Is this following code work in PHP if mysql_connect fails. try{ mysql_connect('localhost','user',''); }catch(Exception $e){ echo $e-getMessage(); Probably not. I don't think that the mysql functions throw exceptions on

Re: [PHP] Exception handling in PHP

2008-02-06 Thread Prabath Kumarasinghe
Does that mean for every exception do we have to write our custom exception and describe it from our own message Cheers Prabath --- Paul Scott [EMAIL PROTECTED] wrote: On Wed, 2008-02-06 at 23:10 -0800, Prabath Kumarasinghe wrote: Is this following code work in PHP if mysql_connect

Re: [PHP] Exception thrown without a stack frame

2008-01-28 Thread Richard Lynch
On Sat, January 26, 2008 2:43 am, Nathan Rixham wrote: way offf topic-ish here.. class destructors, surely they differ from the register_shutdown_function in execution style? seeing as one can echo / do a bit of jiggery pokery before the buffers close. what exactly is the difference?

Re: [PHP] Exception thrown without a stack frame

2008-01-26 Thread Nathan Rixham
way offf topic-ish here.. class destructors, surely they differ from the register_shutdown_function in execution style? seeing as one can echo / do a bit of jiggery pokery before the buffers close. what exactly is the difference? Richard Lynch wrote: On Fri, January 25, 2008 1:31 pm,

Re: [PHP] Exception thrown without a stack frame

2008-01-26 Thread Jochem Maas
Nathan Rixham schreef: way offf topic-ish here.. class destructors, surely they differ from the register_shutdown_function in execution style? seeing as one can echo / do a bit of jiggery pokery before the buffers close. what exactly is the difference? the problem with destructors is

Re: [PHP] Exception thrown without a stack frame

2008-01-25 Thread Jochem Maas
Jochem Maas schreef: I'm getting exceptions thrown without a stackframe. I understand what this means but not how it can happen given the following: 1. *every* frontend script on the site is wrapped in a try/catch block 2. I have set an exception handler to dump these so-called uncaught

[PHP] Exception thrown without a stack frame

2008-01-25 Thread Jochem Maas
I'm getting exceptions thrown without a stackframe. I understand what this means but not how it can happen given the following: 1. *every* frontend script on the site is wrapped in a try/catch block 2. I have set an exception handler to dump these so-called uncaught exceptions in the error log

Re: [PHP] Exception thrown without a stack frame

2008-01-25 Thread Jochem Maas
Peter Ford schreef: Jochem Maas wrote: Jochem Maas schreef: I'm getting exceptions thrown without a stackframe. I understand what this means but not how it can happen given the following: 1. *every* frontend script on the site is wrapped in a try/catch block 2. I have set an exception handler

Re: [PHP] Exception thrown without a stack frame

2008-01-25 Thread Richard Lynch
On Fri, January 25, 2008 1:31 pm, Jochem Maas wrote: setup as via register_shutdown_function(). I missed that bit. Sorry for the noise. shutdown functions are run outside the normal context of PHP, and need special care. Output won't go anywhere, and try/catch won't work, as the bulk of the

Re: [PHP] Exception thrown without a stack frame

2008-01-25 Thread Jochem Maas
Richard Lynch schreef: On Fri, January 25, 2008 4:37 am, Jochem Maas wrote: I'm getting exceptions thrown without a stackframe. I understand what this means but not how it can happen given the following: I wonder if you can wrap a try/catch around the loading of the constants and class

Re: [PHP] Exception thrown without a stack frame

2008-01-25 Thread Richard Lynch
On Fri, January 25, 2008 4:37 am, Jochem Maas wrote: I'm getting exceptions thrown without a stackframe. I understand what this means but not how it can happen given the following: I wonder if you can wrap a try/catch around the loading of the constants and class definitions? Or you already

Re: [PHP] Exception thrown without a stack frame

2008-01-25 Thread Peter Ford
Jochem Maas wrote: Jochem Maas schreef: I'm getting exceptions thrown without a stackframe. I understand what this means but not how it can happen given the following: 1. *every* frontend script on the site is wrapped in a try/catch block 2. I have set an exception handler to dump these

Re: [PHP] Exception thrown without a stack frame

2008-01-25 Thread Eric Butera
On Jan 25, 2008 5:37 AM, Jochem Maas [EMAIL PROTECTED] wrote: I'm getting exceptions thrown without a stackframe. I understand what this means but not how it can happen given the following: 1. *every* frontend script on the site is wrapped in a try/catch block 2. I have set an exception

Re: [PHP] Exception thrown without a stack frame

2008-01-25 Thread Jochem Maas
Eric Butera schreef: On Jan 25, 2008 5:37 AM, Jochem Maas [EMAIL PROTECTED] wrote: I'm getting exceptions thrown without a stackframe. I understand what this means but not how it can happen given the following: 1. *every* frontend script on the site is wrapped in a try/catch block 2. I have

Re: [PHP] Exception thrown without a stack frame

2008-01-25 Thread Eric Butera
On Jan 25, 2008 8:43 AM, Jochem Maas [EMAIL PROTECTED] wrote: Eric Butera schreef: On Jan 25, 2008 5:37 AM, Jochem Maas [EMAIL PROTECTED] wrote: I'm getting exceptions thrown without a stackframe. I understand what this means but not how it can happen given the following: 1. *every*

[PHP] Exception

2005-12-04 Thread mr php
Hello Is it good to use exception handling for error handling or I should use only for exceptions? For example: Is it good to throwing user input errors with throw new Exception(). Thanks

Re: [PHP] Exception

2005-12-04 Thread Anas Mughal
I would recommend keeping error handling and exceptions separate. On 12/4/05, mr php [EMAIL PROTECTED] wrote: Hello Is it good to use exception handling for error handling or I should use only for exceptions? For example: Is it good to throwing user input errors with throw new

Re: [PHP] Exception

2005-12-04 Thread Curt Zirzow
On Sun, Dec 04, 2005 at 08:07:48PM +0330, mr php wrote: Hello Is it good to use exception handling for error handling or I should use only for exceptions? For example: Is it good to throwing user input errors with throw new Exception(). I'm not sure if I understand how you mean by this but

[PHP] PHP, exception and PostgreSQL

2005-02-07 Thread Konference
Hello, is here somebody who works with PostgreSQL in PHP? I have a PL/SQL function, which can raise an exception. I am not able to catch _only_ exception error message in PHP. I can parse Warning: pg_query(): Query failed: ERROR: Exception error string. in... but I think, it is not clear

Re: [PHP] PHP, exception and PostgreSQL

2005-02-07 Thread Richard Lynch
Konference wrote: is here somebody who works with PostgreSQL in PHP? Yes. :-) I have a PL/SQL function, which can raise an exception. I am not able to catch _only_ exception error message in PHP. I can parse Warning: pg_query(): Query failed: ERROR: Exception error string. in... but I

[PHP] Exception handlind in PHP 4 a'la PHP5

2004-02-09 Thread aka MacGuru
Hi, PHP 5 stable is not on the horizon yet. Someone have any idea how to emulate (or to be more precise, simulate), this feature in PHP 4 (I could do it if PHP4 would support macros and goto, but there are no such). Thanks in advance for any suggestion(s).

RE: [PHP] Exception number: c0000005 (access violation

2004-01-12 Thread Jay Blanchard
[snip] I have 4.3.5-dev (Build Dec-22-2003) installed on a W2K Dell Inspiron 7500 and I am getting an error which I don't get with 4.1.1 and 4.3.4. Would like to learn how to debug things like that. Here is a dump of Dr. Watson: [/snip] You will probably want to send this to the PHP developers

Re: [PHP] Exception number: c0000005 (access violation

2004-01-11 Thread Richard Davey
Hello Gunter, Saturday, January 10, 2004, 10:06:03 PM, you wrote: GS I have 4.3.5-dev (Build Dec-22-2003) installed on a W2K Dell Inspiron 7500 GS and I am getting an error which I don't get with 4.1.1 and 4.3.4. Would like GS to learn how to debug things like that. Here is a dump of Dr. Watson:

[PHP] Exception number: c0000005 (access violation

2004-01-10 Thread Gunter Sammet
I have 4.3.5-dev (Build Dec-22-2003) installed on a W2K Dell Inspiron 7500 and I am getting an error which I don't get with 4.1.1 and 4.3.4. Would like to learn how to debug things like that. Here is a dump of Dr. Watson: Application exception occurred: App: (pid=2228) When:

Re: [PHP] Exception number: c0000005 (access violation

2004-01-10 Thread Peter Vertes
Usually under Windows when you get a Memory Access Violation its a good indication that your power supply or RAM is on its way out. Is this happening to all apps or only PHP ? Unfortunately I don't know how to debug using a Dr. Watson dump but I do know of a free memory testing utility called

RE: [PHP] Exception Handling in php

2001-02-28 Thread Ovidiu EFTIMIE
I think that would be nice to have a try-catch to better control of the code. Ovidiu -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 27, 2001 9:09 PM To: kevin1; [EMAIL PROTECTED] Subject: Re: [PHP] Exception Handling in php

[PHP] Exception Handling in php

2001-02-27 Thread kevin1
Is there any equivalent to Java's try-catch or Perl's eval{BLOCK}if($@) structure in PHP? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL

Re: [PHP] Exception Handling in php

2001-02-27 Thread php3
Addressed to: kevin1 [EMAIL PROTECTED] [EMAIL PROTECTED] ** Reply to note from kevin1 [EMAIL PROTECTED] Tue, 27 Feb 2001 08:10:05 -0500 Is there any equivalent to Java's try-catch or Perl's eval{BLOCK}if($@) structure in PHP? No. There has been some discussion about adding it

[PHP] Exception handling

2001-02-15 Thread Alain Fontaine
Hello, Is it impolite to ask about when approximately PHP will support Exception handling ? :) Thanks ! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail:

[PHP] Exception Stack Error

2001-02-08 Thread Ashley M. Kirchner
I just compiled apache_1.3.17, mod_perl-1.25 and php-4.0.4pl1. However, now when I try to start apache, I get the following error: Fatal System Error: Raise at top of Exception Stack Where might this error be coming from? Apache? PHP? Some other PHP extension I might have