Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » PHP
  • » [PHP-DEV] Proper return after throwing exception [RSS Feed]

#1 June 11, 2010 00:16:28

Alexey Z.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Proper return after throwing exception


On 10.06.2010, at 23:41, Pieter de Zwart wrote:

> Hey guys,
>
> Another n00b question: What is the proper way to return from a function
> after throwing an exception? My code looks like:
>
> zend_throw_exception(amqp_connection_exception_class_entry, "blah blah
> blah", 0 TSRMLS_CC);
> return;
>
> Should I instead RETURN_FALSE from there?

It doesn't really matter, as return value will never be checked.
"return" should be enough


--
Alexey Zakhlestinhttp://www.milkfarmsoft.com/smime.p7sDescription:S/MIME cryptographic signature

Attachments:
attachment smime.p7s (2.6 KB)

Offline

#2 June 11, 2010 18:24:57

Daniel C.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Proper return after throwing exception


Hi Pieter:

On Thu, Jun 10, 2010 at 12:41:29PM -0700, Pieter de Zwart wrote:
>
> zend_throw_exception(amqp_connection_exception_class_entry, "blah blah
> blah", 0 TSRMLS_CC);
> return;

These kinds of questions (regarding how to use PHP) should be asked on
the php-general list. The internals list you wrote to is for discussions
of how to make PHP.

Anyway, the "return" line in your code can never be reached, so should
not be there at all.

--Dan

--
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
data intensive web and database programminghttp://www.AnalysisAndSolutions.com/4015 7th Ave #4, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#3 June 11, 2010 18:35:37

Hannes M.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Proper return after throwing exception


On Fri, Jun 11, 2010 at 19:24, Daniel Convissor
<dani***@*nalysisandsolutions.com> wrote:
> Hi Pieter:
>
> On Thu, Jun 10, 2010 at 12:41:29PM -0700, Pieter de Zwart wrote:
>>
>> zend_throw_exception(amqp_connection_exception_class_entry, "blah blah
>> blah", 0 TSRMLS_CC);
>> return;
>
> These kinds of questions (regarding how to use PHP) should be asked on
> the php-general list.  The internals list you wrote to is for discussions
> of how to make PHP.

Which part of "zend_throw_exception()" sounds like a php-general@ question?

I think you misread his question :)

-Hannes

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#4 June 12, 2010 15:34:52

Daniel C.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Proper return after throwing exception


Hi Hannes:

On Fri, Jun 11, 2010 at 07:34:54PM +0200, Hannes Magnusson wrote:
>
> Which part of "zend_throw_exception()" sounds like a php-general@ question?

DOH!

--Dan

--
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
data intensive web and database programminghttp://www.AnalysisAndSolutions.com/4015 7th Ave #4, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

  • Root
  • » PHP
  • » [PHP-DEV] Proper return after throwing exception [RSS Feed]

Board footer

Moderator control

Enjoy the 15th of December
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support