Re: [PHP-DEV] Re: [PHP-CVS] com php-src: Remove curl wrappers: ext/curl/config.m4 ext/curl/config.w32 ext/curl/interface.c ext/curl/php_curl.h ext/curl/streams.c ext/standard/basic_functions.c
On 2013-04-25, Stas Malyshev smalys...@sugarcrm.com wrote: Hi! Shouldn't we Keep CURL_WRAPPERS_ENABLED defined to 0 ? or remove it from PHP-5.4 before 5.4.15 ? (was not included in any official version yet) Since the wrappers are gone, I think we should just drop it. If I don't hear any objections and nobody beats me to it, I'll do it this weekend. Since it's a revert, I think it's OK to do it in the RC branch too. Yes please go ahead and revert it. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Continued try blocks
Hello internals, I had an idea recently with a friend, about a feature try-catch blocks could use. Let me just write an example, you will quickly understand the idea : *?php* * * *try {* * foo();* * bar();* * baz();* *} catch (SomeException $e) {* *dosomestuff();* *continue; /* Here is the feature, go back to try block */* *} catch (Exception $e) {* *dosomething();* *}* The continue keyword would resume the execution from where it had diverged, according to the function which led to the SomeException catch block. So, in this example, if, say, bar() throws a SomeException , the code would then resume and execute baz() after the catch block. Just presenting the idea here, no RFC actually , I'm collecting thoughts and notices. Julien.Pauli
Re: [PHP-DEV] Continued try blocks
Sounds interesting. And what about the second attempt passing the try block without goto? 2013/4/26 Julien Pauli jpa...@php.net Hello internals, I had an idea recently with a friend, about a feature try-catch blocks could use. Let me just write an example, you will quickly understand the idea : *?php* * * *try {* * foo();* * bar();* * baz();* *} catch (SomeException $e) {* *dosomestuff();* *continue; /* Here is the feature, go back to try block */* *} catch (Exception $e) {* *dosomething();* *}* The continue keyword would resume the execution from where it had diverged, according to the function which led to the SomeException catch block. So, in this example, if, say, bar() throws a SomeException , the code would then resume and execute baz() after the catch block. Just presenting the idea here, no RFC actually , I'm collecting thoughts and notices. Julien.Pauli
Re: [PHP-DEV] Continued try blocks
2013/4/26 Julien Pauli jpa...@php.net Hello internals, I had an idea recently with a friend, about a feature try-catch blocks could use. Let me just write an example, you will quickly understand the idea : *?php* * * *try {* * foo();* * bar();* * baz();* *} catch (SomeException $e) {* *dosomestuff();* *continue; /* Here is the feature, go back to try block */* *} catch (Exception $e) {* *dosomething();* *}* This seems like a BC break: for ( ; ; ) { try { ... } catch (Exception $e) { continue; } } With the proposed syntax, continue will no longer refer to the for loop. The continue keyword would resume the execution from where it had diverged, according to the function which led to the SomeException catch block. So, in this example, if, say, bar() throws a SomeException , the code would then resume and execute baz() after the catch block. Just presenting the idea here, no RFC actually , I'm collecting thoughts and notices. Julien.Pauli Lazare INEPOLOGLOU Ingénieur Logiciel
Re: [PHP-DEV] Continued try blocks
On Friday 26 April 2013 16:41:17 Julien Pauli wrote: *try {* * foo();* * bar();* * baz();* *} catch (SomeException $e) {* *dosomestuff();* *continue; /* Here is the feature, go back to try block */* *} catch (Exception $e) {* *dosomething();* *}* ... So, in this example, if, say, bar() throws a SomeException , the code would then resume and execute baz() after the catch block. What exactly would it continue with? The next instruction after whereever the throw was? The toplevel function call (or other code) next after the toplevel function in the try block that threw up? The first answer won't work because any object live when bar() threw but only referenced in the call stack below the try block, will already have been destructed. The second answer appears ... semantically dubious. best regards Patrick -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Continued try blocks
I will answer, as the idea came from Pierrick Charron and I :-) Sometimes, you call functions (or methods) and you know they can throw some exceptions. But you don't want to stop all computations just because one of them raised an exception. Maybe you just want to log it, and go to the next call. If you write that: try { $o-method1(); $o-method2(); $o-method3(); } catch (Exception $e) { add_to_log($e-getMessage()); } If method1() raises an exception, it's not possible to execute method2(). And so it forces us to write ugly code like that: try { $o-method1(); } catch (Exception $e) { add_to_log($e-getMessage()); } try { $o-method2(); } catch (Exception $e) { add_to_log($e-getMessage()); } try { $o-method3(); } catch (Exception $e) { add_to_log($e-getMessage()); } But honestly, nobody uses a try/catch block for every single line of code! Unfortunately, it's sometimes the only solution... What I'm suggesting is to be able to continue the code execution, from to point where an exception was raised. try { $o-method1(); $o-method2(); $o-method3(); } catch (Exception $e) { add_to_log($e-getMessage()); continue; } In this example, if method1() raises an exception, it will be logged, and then method2() will be called. If method2() raises an exception, it will be logged, and then method3() will be called. Is method3() raises an exception, it will be logged, and the execution will continue after the try/catch block. continue is the best keyword for that: The meaning is please, continue the execution of my code :-) As Julien said, there is a BC break, when a try/catch block is written inside a loop. But I think it's not a major usage, and it's a minor inconvenient. Amaury 2013/4/26 Patrick Schaaf p...@bof.de On Friday 26 April 2013 16:41:17 Julien Pauli wrote: *try {* * foo();* * bar();* * baz();* *} catch (SomeException $e) {* *dosomestuff();* *continue; /* Here is the feature, go back to try block */* *} catch (Exception $e) {* *dosomething();* *}* ... So, in this example, if, say, bar() throws a SomeException , the code would then resume and execute baz() after the catch block. What exactly would it continue with? The next instruction after whereever the throw was? The toplevel function call (or other code) next after the toplevel function in the try block that threw up? The first answer won't work because any object live when bar() threw but only referenced in the call stack below the try block, will already have been destructed. The second answer appears ... semantically dubious. best regards Patrick -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Continued try blocks
Hi 2013/4/26 Lazare Inepologlou linep...@gmail.com: This seems like a BC break: for ( ; ; ) { try { ... } catch (Exception $e) { continue; } } With the proposed syntax, continue will no longer refer to the for loop. Well, at the moment continue is assigned to only usage in loops, we also have break (switch) which works for both loops and construct, if break is used inside a construct, thats inside a loop, it will be seen as a part of the construct, we could change continue to work the same as that. -- regards, Kalle Sommer Nielsen ka...@php.net -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Total Access to the Concert Industry for Just $1 per Day!
Access to the most current industry news and information including: - Over 47,000 detailed celebrity profiles - Box office scores - Complete agency and management rosters - Responsible and Territorial agents - Performance fees, production information, artist bios - Record company profiles, CD release dates - Tour dates, artist avails, website urls - Database of North American talent buyers including local, regional and national promoters - Direct emails, phone, fax - Over 10,000 North American venue profiles - Online offer forms and mass email system - Comprehensive industry news updated hourly - Events calendar, posting boards, industry resources - FREE Subscription to Encore weekly Ezine! CelebrityAccess Special Pricing Single-User Annual Membership $365.00 Save over $500.00! Each Additional User at your Company: $100.00 Call us today at 303-350-1700 or email us at sa...@celebrityaccess.com Offer expires May 15, 2013 and is for first-time members only. CelebrityAccess 2401 Broadway Boulder, CO 80304 Ph. 303-350-1700 Fx. 303-339-6877 www.celebrityaccess.com Our Talent Buyers use CelebrityAccess on a daily basis. It helps us save our most valuable resource, time. -Dean DeWulf/AEG Live CelebrityAccess is my primary site throughout the work day. It's an amazing tool that I have grown to depend on. In fact, it's now my home page when I launch my browser. It's vital to what I do. -Brian Swanson/Monterey International I have been amazed by the depth and accuracy of the information available here, as well as pleasantly surprised at how many of my jaded peers actually respond to emails so much better than they do to phone messages! -Bruce Houghton-President/Skyline Music Read what more people are saying about CelebrityAccess at: http://www.celebrityaccess.com/rave_reviews.php Attention Artist Representatives: Maximize exposure for your artist(s) report your tour routings, box office revenues, press releases, and other information for immediate posting to http://www.celebrityaccess.com/update/index.php If you choose not to receive future emails, please reply with Remove in the Subject Line. P Reduce your footprint- Please don't print this e-mail unless necessary.
[PHP-DEV] PDO Extension contributions
Ola, my name is Guilherme Capilé, I'm a Brazilian developer and I'd like to contribute to the PHP-SRC. Right now, specifically to the PDO DBLIB (ext/pdo_dblib) extension. I've already submitted a bug, a patch and a pull request, a month ago, but haven't got any responses so far -- looks like no one else is interested in this extension. The last time it was actively developed was almost two years ago, and the bug I mentioned makes this extension unusable as of PHP 5.4+ (it was introduced on PHP 5.4 back at 2010). I'd also like to enable other features available on other PDO extensions, like driver/session attributes (DBLIB has none), and resolve some of the bugs listed for it, but don't know if such contributions are welcome. If I can contribute, I'd like to just know how, and if the former developers Stanley Sufficool, Felipe Pena, Rasmus Lerdorf among others have any thoughts and considerations on future progress. Otherwise, if this extension is marked for death, please let me know so that I can search for alternatives. I already e-mailed the PDO list, and the only response I got was a suggestion to email this list instead... Cheers, Guilherme Capilé -- Tecnodesign • • • • • • • • • [55 21] 4105-1033 http://www.tecnodz.com cap...@tecnodz.com -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Continued try blocks
Am 26.04.13 16:41, schrieb Julien Pauli: Hello internals, I had an idea recently with a friend, about a feature try-catch blocks could use. Let me just write an example, you will quickly understand the idea : *?php* * * *try {* * foo();* * bar();* * baz();* *} catch (SomeException $e) {* *dosomestuff();* *continue; /* Here is the feature, go back to try block */* *} catch (Exception $e) {* *dosomething();* *}* The continue keyword would resume the execution from where it had diverged, according to the function which led to the SomeException catch block. So, in this example, if, say, bar() throws a SomeException , the code would then resume and execute baz() after the catch block. Just presenting the idea here, no RFC actually , I'm collecting thoughts and notices. Julien.Pauli Hi Julien. What about the following example? try { $foo = $bar-getObject(); $foo-doSomething() } catch(Exception $e) { continue // Or whatever shall be used } When $bar-getObject throws an Exception no $foo is set. So the next line will result in a PHP Fatal error: Call to a member function doSomething() on a non-object. So where shall the continue actually continue? In the line after the exception was thrown? In the line following the last line $foo was accessed in? Or would something like CreateTryCatchBlockForEverySingleLine { $bar-doOne(); $bar-doNext(); $bar-doSomethingElse(); } catch(Exception $e) { doSomethingWithTheException($e); } resulting in try { $bar-doOne(); } catch(Exception $e) { doSomethingWithTheException($e); } try { $bar-doNext(); } catch(Exception $e) { doSomethingWithTheException($e); } try { $bar-doSomethingElse(); } catch(Exception $e) { doSomethingWithTheException($e); } be more what you are talking about? Regards Andreas -- ,,, (o o) +-ooO-(_)-Ooo-+ | Andreas Heigl | | mailto:andr...@heigl.org N 50°22'59.5 E 08°23'58 | | http://andreas.heigl.org http://hei.gl/wiFKy7 | +-+ | http://hei.gl/root-ca | +-+ smime.p7s Description: S/MIME Kryptografische Unterschrift
AW: [PHP-DEV] Continued try blocks
I like the idea but would prefer another control structure such as CreateTryCatchBlockForEverySingleLine (should be shorter though) rather than continue. The continue keyword is confusing in my opinion. And I would say it should be for every single statement whereupon a statement is defined by either ; or {} rather then for every single line. Thus the following code: tryStatements{ $a = foo(); if($a 1){ $i = bar(); }else{ $i = muu(); } for(;$i10;$i++){ //.. } }catch(Exception $ex){ log($ex); } Would result in: try{ $a = foo(); } catch(Exception $ex){ log($ex); } try{ if($a 1){ $i = bar(); }else{ $i = muu(); } } catch(Exception $ex){ log($ex); } try{ for(;$i10;$i++){ //.. } } catch(Exception $ex){ log($ex); } -Ursprüngliche Nachricht- Von: Andreas Heigl [mailto:andr...@heigl.org] Gesendet: Freitag, 26. April 2013 20:15 An: Julien Pauli Cc: PHP Internals Betreff: Re: [PHP-DEV] Continued try blocks Am 26.04.13 16:41, schrieb Julien Pauli: Hello internals, I had an idea recently with a friend, about a feature try-catch blocks could use. Let me just write an example, you will quickly understand the idea : *?php* * * *try {* * foo();* * bar();* * baz();* *} catch (SomeException $e) {* *dosomestuff();* *continue; /* Here is the feature, go back to try block */* *} catch (Exception $e) {* *dosomething();* *}* The continue keyword would resume the execution from where it had diverged, according to the function which led to the SomeException catch block. So, in this example, if, say, bar() throws a SomeException , the code would then resume and execute baz() after the catch block. Just presenting the idea here, no RFC actually , I'm collecting thoughts and notices. Julien.Pauli Hi Julien. What about the following example? try { $foo = $bar-getObject(); $foo-doSomething() } catch(Exception $e) { continue // Or whatever shall be used } When $bar-getObject throws an Exception no $foo is set. So the next line will result in a PHP Fatal error: Call to a member function doSomething() on a non-object. So where shall the continue actually continue? In the line after the exception was thrown? In the line following the last line $foo was accessed in? Or would something like CreateTryCatchBlockForEverySingleLine { $bar-doOne(); $bar-doNext(); $bar-doSomethingElse(); } catch(Exception $e) { doSomethingWithTheException($e); } resulting in try { $bar-doOne(); } catch(Exception $e) { doSomethingWithTheException($e); } try { $bar-doNext(); } catch(Exception $e) { doSomethingWithTheException($e); } try { $bar-doSomethingElse(); } catch(Exception $e) { doSomethingWithTheException($e); } be more what you are talking about? Regards Andreas -- ,,, (o o) +-ooO-(_)-Ooo-+ | Andreas Heigl | | mailto:andr...@heigl.org N 50°22'59.5 E 08°23'58 | | http://andreas.heigl.org http://hei.gl/wiFKy7 | +-+ | http://hei.gl/root-ca | +-+ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Continued try blocks
2013/4/26 Andreas Heigl andr...@heigl.org try { $foo = $bar-getObject(); $foo-doSomething() } catch(Exception $e) { continue // Or whatever shall be used } When $bar-getObject throws an Exception no $foo is set. So the next line will result in a PHP Fatal error: Call to a member function doSomething() on a non-object. That's fine to me. It's a software engineering problem you can solve easily: try { $foo = $bar-getObject(); $foo-doSomething(); } catch (ObjectCreationException $oce) { add_to_log('Unable to create object'); throw $oce; // or do something else, // or just do nothing to exit from the try/catch block } catch (Exception $e) { add_to_log($e-getMessage()); continue; } The getObject() method should raise an ObjectCreationException, while the doSomething() method could raise any other type of exception. It's just a natural and smart way to use exceptions. It could be solve differently: try { $foo = $bar-getObject(); $foo-doSomething(); } catch (NotImportantException $nie) { add_to_log($nie-getMessage()); continue; } catch (Exception $e) { add_to_log($e-getMessage()); throw $e; // or do something else, // or just do nothing to exit from the try/catch block } If an expression raises a NotImportantException, it will not interrupt the execution flow.