Re: [PHP-DEV] Error handling brainstorming

2012-08-06 Thread Levi Morrison
>> errors, you can't just fread the return value. You *need* to change your >> execution flow based on that error. Therefore, it is exceptional. > > That's exactly what I am saying. Exceptions should not be a means of > flow control, and that's exactly what are you doing here. I agree that excepti

Re: [PHP-DEV] Error handling brainstorming

2012-08-06 Thread Stas Malyshev
Hi! > circumstance. If it's not, you should be checking for existence first > (via file_exists() or is_readable(), etc)... This is exactly how we got into this mess with $x = isset($a['x'])?$a['x']:null; We're trying to get out of this mess and you're proposing to build another mess just like th

Re: [PHP-DEV] Error handling brainstorming

2012-08-06 Thread Anthony Ferrara
Levi et al: On Mon, Aug 6, 2012 at 8:55 PM, Levi Morrison wrote: > >> Because checking that the returned variable is `!== FALSE` is *way* > >> better than throwing an exception, right? > > > > Yes, it is. You can control it, unlike the exception which you can not, > > unless, again, you wrap ever

Re: [PHP-DEV] Error handling brainstorming

2012-08-06 Thread Levi Morrison
>> Because checking that the returned variable is `!== FALSE` is *way* >> better than throwing an exception, right? > > Yes, it is. You can control it, unlike the exception which you can not, > unless, again, you wrap everything into try/catch on every kind of > exception possible. > >> This type o

Re: [PHP-DEV] Error handling brainstorming

2012-08-06 Thread Jannik Zschiesche
Hi all, Am 06.08.2012 20:41, schrieb Stas Malyshev: Hi! Because checking that the returned variable is `!== FALSE` is *way* better than throwing an exception, right? Yes, it is. You can control it, unlike the exception which you can not, unless, again, you wrap everything into try/catch on e

[PHP-DEV] [PATCH] Fix per-module logging in apache 2.4

2012-08-06 Thread Cristian Rodríguez
--- sapi/apache2filter/sapi_apache2.c |3 +++ sapi/apache2handler/mod_php5.c|4 2 files changed, 7 insertions(+) diff --git a/sapi/apache2filter/sapi_apache2.c b/sapi/apache2filter/sapi_apache2.c index 0b51cfb..a8fec5c 100644 --- a/sapi/apache2filter/sapi_apache2.c +++ b/sapi/ap

[PHP-DEV] mbstring, a proposition of additional functions

2012-08-06 Thread Ivan Enderlin @ Hoa
Hello, ext/mbstring is very useful, but from my point of view, some functions are missing. I would like to propose the addition of the following functions. mb_append($str, $piece) and mb_prepend($str, $piece): To add a $piece to, respectively, the end and the start of $string. It should consi

Re: [PHP-DEV] Error handling brainstorming

2012-08-06 Thread Ralf Lang
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Am 06.08.2012 20:44, schrieb Stas Malyshev: > Hi! > >> but sometimes you want to be more precise. With exceptions, we >> have an elegant way to manage all failures as a whole, or to >> differenciate each reason. > > You do not, unless you have 20 exc

Re: [PHP-DEV] Error handling brainstorming

2012-08-06 Thread Andrew Faulds
On 06/08/12 19:48, Stas Malyshev wrote: Hi! Personally, I'm used to what other languages like Python do, and I think it makes more sense. Exceptions mean you can try/catch the things your code needs to be prepared for (non-existence, maybe), but other things No, they mean you need to *always*

Re: [PHP-DEV] Error handling brainstorming

2012-08-06 Thread Stas Malyshev
Hi! > Personally, I'm used to what other languages like Python do, and I think > it makes more sense. Exceptions mean you can try/catch the things your > code needs to be prepared for (non-existence, maybe), but other things No, they mean you need to *always* try/catch since you have to means

Re: [PHP-DEV] Error handling brainstorming

2012-08-06 Thread Stas Malyshev
Hi! > but sometimes you want to be more precise. With exceptions, we have an > elegant way to manage all failures as a whole, or to differenciate each > reason. You do not, unless you have 20 exception types and catch them all separately. Which nobody would ever do for one simple reason - what if

Re: [PHP-DEV] Error handling brainstorming

2012-08-06 Thread Stas Malyshev
Hi! > Because checking that the returned variable is `!== FALSE` is *way* > better than throwing an exception, right? Yes, it is. You can control it, unlike the exception which you can not, unless, again, you wrap everything into try/catch on every kind of exception possible. > This type of thin

Re: [PHP-DEV] [RFC] Remove calls with incompatible Context

2012-08-06 Thread jpauli
On Sat, Aug 4, 2012 at 12:36 AM, Etienne Kneuss wrote: > On Mon, Jul 30, 2012 at 7:31 PM, Gustavo Lopes wrote: >> https://wiki.php.net/rfc/incompat_ctx >> >> An RFC for deprecating and removing $this from incompatible context. >> >> Comments are welcome. After several explanations with Etienne o

Re: [PHP-DEV] Error handling brainstorming

2012-08-06 Thread Andrew Faulds
On 06/08/12 08:43, Amaury Bouchard wrote: 2012/8/6 Stas Malyshev Exceptions are different from PHP errors. For example, if you try to open a file and the file isn't there, throwing exception is a very annoying behavior (yes I know some languages do that, IMO it's wrong). The reason is that it'

[PHP-DEV] [Voting] Call for voting for RFC: Supports finally keyword

2012-08-06 Thread Laruence
Hi: We have discussed this RFC for a while, and seems no new suggestion raise up. previous discussion could be found here: http://marc.info/?l=php-internals&m=134312917227815&w=2 So, Let's voting for it: https://wiki.php.net/rfc/finally#vote :) thanks -- Laruence Xinchen Hui http://

Re: [PHP-DEV] [RFC] Remove calls with incompatible Context

2012-08-06 Thread jpauli
On Sat, Aug 4, 2012 at 12:40 AM, Andrew Faulds wrote: > While we're at it, > > $a = 'this'; > $$a = new StdClass(); > > should be an error. > Also $GLOBALS['this'] = new StdClass(); > > https://bugs.php.net/bug.php?id=52428 Hehe, I already caught all those executor tricks, like : http://www.php.n

Re: [PHP-DEV] Re: [php-maint] Bug#612743: php5: PHP is compiled with LFS support, but this can not be detected by extensions

2012-08-06 Thread Derick Rethans
On Sat, 28 Jul 2012, Ferenc Kovacs wrote: > On Fri, Mar 18, 2011 at 5:08 PM, Derick Rethans > wrote: > > > On Fri, 18 Mar 2011, Ondřej Surý wrote: > > > > > On Thu, Feb 10, 2011 at 13:37, Ondřej Surý wrote: > > > > > > > On Thu, Feb 10, 2011, Derick wrote: > > > > > > > >> I know it doesn't; I

Re: [PHP-DEV] Error handling brainstorming

2012-08-06 Thread Amaury Bouchard
2012/8/6 Stas Malyshev > Exceptions are different from PHP errors. For example, if you try to > open a file and the file isn't there, throwing exception is a very > annoying behavior (yes I know some languages do that, IMO it's wrong). > The reason is that it's pretty normal and within normal set