Re: Re: [PATCH] Notice on array to string convertion

From: Date: Mon, 06 Jun 2011 16:32:17 +0000
Subject: Re: Re: [PATCH] Notice on array to string convertion
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-53045@lists.php.net to get a copy of this message
On 2011-06-06, Ferenc Kovacs <info@tyrael.hu> wrote: > --00261883a59c62fbe404a50bd89c > Content-Type: text/plain; charset=UTF-8 > > On Mon, Jun 6, 2011 at 3:36 PM, Matthew Weier O'Phinney < > weierophinney@php.net> wrote: > > > On 2011-06-02, Patrick ALLAERT <patrickallaert@php.net> wrote: > > > I would like to introduce an E_NOTICE when an array is silently > > > converted to a string. > > > This isn't very useful as it constantly produces the following string: > > > "Array" and in most of the case, this is a sign of an error. > > > > > > Let me know about your feelings. > > > > +1 (for E_NOTICE) > > > > This allows warning folks easily during development of potential issues, > > and for those of us using tools like PHPUnit, we'll catch the problem > > early. At the same time, it doesn't break existing code. > > > > > I'm curious, why do you think that E_WARNING would break existing code? I didn't mean to imply E_WARNING would break existing code. However, I've often seen error handlers that break execution on E_WARNING and above -- and I'm not 100% convinced that this would be a situation warranting a warning. It "feels" more akin to a notice from accessing an unset array key. Either way, however, if I'm using PHPUnit, I'll be notified. :) > the only think that I can come up with, that some people runs with > display_errors = On, and they doesn't mask E_WARNINGs with > error_reporting. I think that this would be more reason to use > E_WARNING there, else those people won't get noticed about this > problem. I personally run E_ALL | E_STRICT, so I catch either -- and log when in production. As noted, it's personal preference. I'm okay with either flag, to be honest. -- Matthew Weier O'Phinney Project Lead | matthew@zend.com Zend Framework | http://framework.zend.com/ PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

« previous php.internals (#53045) next »