RE: [PHP-DEV] [PATCH] Notice on array to string convertion

2011-06-04 Thread John Crenshaw
think of one. John Crenshaw Priacta, Inc. -Original Message- From: Johannes Schlüter [mailto:johan...@schlueters.de] Sent: Saturday, June 04, 2011 8:46 PM To: Pierre Joye Cc: Patrick ALLAERT; PHP Development Subject: Re: [PHP-DEV] [PATCH] Notice on array to string convertion On Thu, 2011

Re: [PHP-DEV] [PATCH] Notice on array to string convertion

2011-06-04 Thread Johannes Schlüter
On Thu, 2011-06-02 at 15:29 +0200, Pierre Joye wrote: > hi, > > I like this for the current stable branch, no bc impact and gives a > way to detect such mistakes (not ideal but better than nothing). This has an BC impact. some stupid error handler might be triggered which might break an applicati

Re: [PHP-DEV] [PATCH] Notice on array to string convertion

2011-06-04 Thread David Zülke
I think for consistency's sake it should be a notice as the same is already done in _convert_to_string(). In fact, couldn't zend_make_printable_zval() use _convert_to_string()? - David On 03.06.2011, at 09:57, Derick Rethans wrote: > On Thu, 2 Jun 2011, Ilia Alshanetsky wrote: > >> I like th

Re: [PHP-DEV] [PATCH] Notice on array to string convertion

2011-06-03 Thread Patrick ALLAERT
2011/6/2 Ilia Alshanetsky : > I like the idea of an error message when this happens, but as few > other people in the thread had mentioned, I think it should be a > warning (E_WARNING) because the conversion results in data loss > (content of the array is replaced with "Array" string). My initial

Re: [PHP-DEV] [PATCH] Notice on array to string convertion

2011-06-03 Thread Derick Rethans
On Thu, 2 Jun 2011, Ilia Alshanetsky wrote: > I like the idea of an error message when this happens, but as few > other people in the thread had mentioned, I think it should be a > warning (E_WARNING) because the conversion results in data loss > (content of the array is replaced with "Array" stri

Re: [PHP-DEV] [PATCH] Notice on array to string convertion

2011-06-03 Thread Ferenc Kovacs
On Fri, Jun 3, 2011 at 1:05 AM, Arvids Godjuks wrote: > +1 on E_NOTICE > 02.06.2011 19:13 пользователь "Ilia Alshanetsky" > написал: > > I like the idea of an error message when this happens, but as few > > other people in the thread had mentioned, I think it should be a > > warning (E_WARNING)

Re: [PHP-DEV] [PATCH] Notice on array to string convertion

2011-06-02 Thread Arvids Godjuks
+1 on E_NOTICE 02.06.2011 19:13 пользователь "Ilia Alshanetsky" написал: > I like the idea of an error message when this happens, but as few > other people in the thread had mentioned, I think it should be a > warning (E_WARNING) because the conversion results in data loss > (content of the array

Re: [PHP-DEV] [PATCH] Notice on array to string convertion

2011-06-02 Thread Ilia Alshanetsky
I like the idea of an error message when this happens, but as few other people in the thread had mentioned, I think it should be a warning (E_WARNING) because the conversion results in data loss (content of the array is replaced with "Array" string). On Thu, Jun 2, 2011 at 12:11 PM, Patrick ALLAER

Re: [PHP-DEV] [PATCH] Notice on array to string convertion

2011-06-02 Thread Patrick ALLAERT
2011/6/2 Reindl Harald : > Am 02.06.2011 16:24, schrieb Marcel Esser: >> I am not convinced that making this an error is a good idea. >> >> If I receive a $_GET/$_POST value that I expect to be a string value, but I >> actually received an array, this would >> mean I need to now explicitly check f

Re: [PHP-DEV] [PATCH] Notice on array to string convertion

2011-06-02 Thread Pierre Joye
may I suggest to both of you to continue this rant off line please? The initial question was rather simple and only about this specific case. And we seem to agree on the necessity to have a notice/warning here. That's the maximum we can do at this stage, both for 5.3 and 5.4. On Thu, Jun 2, 2011

Re: [PHP-DEV] [PATCH] Notice on array to string convertion

2011-06-02 Thread Marcel Esser
I'm pretty sure you've never seen my code, so I am not going to comment on that. However, speaking not just for myself, two ternary operations and two functions calls to just prevent a stoppage code of execution, never mind input filtering for a second, is not entirely reasonable considering t

Re: [PHP-DEV] [PATCH] Notice on array to string convertion

2011-06-02 Thread Reindl Harald
Am 02.06.2011 17:01, schrieb Peter Lind: > On 2 June 2011 16:50, Reindl Harald wrote: >> Am 02.06.2011 16:24, schrieb Marcel Esser: >>> I am not convinced that making this an error is a good idea. >>> >>> If I receive a $_GET/$_POST value that I expect to be a string value, but I >>> actually re

Re: [PHP-DEV] [PATCH] Notice on array to string convertion

2011-06-02 Thread Marcel Esser
I agree entirely. Let me go ahead and fix these three billion man hours worth of code in use through-out the world. I'll be back shortly. - M. On 6/2/2011 11:19 AM, Reindl Harald wrote: first rule of programming: sanitize user input if you EXPECT no array catch it Am 02.06.2011 16:54, schri

Re: [PHP-DEV] [PATCH] Notice on array to string convertion

2011-06-02 Thread Philip Olson
On Jun 2, 2011, at 8:01 AM, Peter Lind wrote: > On 2 June 2011 16:50, Reindl Harald wrote: >> >> >> Am 02.06.2011 16:24, schrieb Marcel Esser: >>> I am not convinced that making this an error is a good idea. >>> >>> If I receive a $_GET/$_POST value that I expect to be a string value, but I

Re: [PHP-DEV] [PATCH] Notice on array to string convertion

2011-06-02 Thread Reindl Harald
first rule of programming: sanitize user input if you EXPECT no array catch it Am 02.06.2011 16:54, schrieb Marcel Esser: > You don't need a form to receive bad user input. > > Also, I am not really inclined to write $v = isset($_POST['x']) ? > (is_array($_POST['x']) ? 'something else that > mak

Re: [PHP-DEV] [PATCH] Notice on array to string convertion

2011-06-02 Thread Rune Kaagaard
> Am 02.06.2011 14:56, schrieb Rune Kaagaard: >>> this conversion should never happen and throw a fatal error since this >>> action is destructive to data and never useful nor will warnings/notices >>> helps in the real world I agree totally that such a conversion should never happen. If we could

Re: [PHP-DEV] [PATCH] Notice on array to string convertion

2011-06-02 Thread Peter Lind
On 2 June 2011 16:50, Reindl Harald wrote: > > > Am 02.06.2011 16:24, schrieb Marcel Esser: >> I am not convinced that making this an error is a good idea. >> >> If I receive a $_GET/$_POST value that I expect to be a string value, but I >> actually received an array, this would >> mean I need to

Re: [PHP-DEV] [PATCH] Notice on array to string convertion

2011-06-02 Thread Marcel Esser
You don't need a form to receive bad user input. Also, I am not really inclined to write $v = isset($_POST['x']) ? (is_array($_POST['x']) ? 'something else that makes more sense' : $_POST['x'] ) : null; just to avoid catching a fatal. - M. On 6/2/2011 10:50 AM, Reindl Harald wrote: Am 02.

Re: [PHP-DEV] [PATCH] Notice on array to string convertion

2011-06-02 Thread Reindl Harald
Am 02.06.2011 16:24, schrieb Marcel Esser: > I am not convinced that making this an error is a good idea. > > If I receive a $_GET/$_POST value that I expect to be a string value, but I > actually received an array, this would > mean I need to now explicitly check for it, since it will stop the

Re: [PHP-DEV] [PATCH] Notice on array to string convertion

2011-06-02 Thread Tomas Creemers
The choice between E_WARNING and E_NOTICE is simple if we look at the definitions of the levels (http://php.net/manual/en/errorfunc.constants.php). E_NOTICE is defined as "Run-time notices. Indicate that the script encountered something that could indicate an error, but could also happen in the no

Re: [PHP-DEV] [PATCH] Notice on array to string convertion

2011-06-02 Thread Justin Carmony
+1 Sent from my iPhone On Jun 2, 2011, at 4:19 AM, Patrick ALLAERT wrote: > Hi, > > 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

Re: [PHP-DEV] [PATCH] Notice on array to string convertion

2011-06-02 Thread Ole Markus With
On Thu, 02 Jun 2011 15:38:00 +0200, Brian Moon wrote: I like this for the current stable branch, no bc impact and gives a way to detect such mistakes (not ideal but better than nothing). On Thu, Jun 2, 2011 at 12:11 PM, Patrick ALLAERT wrote: Hi, I would like to introduce an E_NOTICE when

Re: [PHP-DEV] [PATCH] Notice on array to string convertion

2011-06-02 Thread Marcel Esser
I am not convinced that making this an error is a good idea. If I receive a $_GET/$_POST value that I expect to be a string value, but I actually received an array, this would mean I need to now explicitly check for it, since it will stop the runtime otherwise. Example: http://home.sweet.home

Re: [PHP-DEV] [PATCH] Notice on array to string convertion

2011-06-02 Thread Alain Williams
On Thu, Jun 02, 2011 at 04:07:25PM +0200, Patrick ALLAERT wrote: > Not true. Here is a valid example that would break after implementing > this as en error. > > if ("$x" == "Array") { > array_walk( $x, "print_r" ); > } > > I'm not saying that this is good code, I'm only saying that this woul

Re: [PHP-DEV] [PATCH] Notice on array to string convertion

2011-06-02 Thread Patrick ALLAERT
2011/6/2 Brian Moon : >> I like this for the current stable branch, no bc impact and gives a >> way to detect such mistakes (not ideal but better than nothing). >> >> On Thu, Jun 2, 2011 at 12:11 PM, Patrick ALLAERT >>  wrote: >>> >>> Hi, >>> >>> I would like to introduce an E_NOTICE when an array

Re: [PHP-DEV] [PATCH] Notice on array to string convertion

2011-06-02 Thread Patrick ALLAERT
2011/6/2 Reindl Harald : > > > Am 02.06.2011 15:04, schrieb John LeSueur: >> On Thu, Jun 2, 2011 at 6:24 AM, Reindl Harald wrote: >> First, I agree that converting to json/imploding would be a bad idea. >> There's no guarantee that the developer wanted to use the array in that way, >> or even >> t

Re: [PHP-DEV] [PATCH] Notice on array to string convertion

2011-06-02 Thread Brian Moon
I like this for the current stable branch, no bc impact and gives a way to detect such mistakes (not ideal but better than nothing). On Thu, Jun 2, 2011 at 12:11 PM, Patrick ALLAERT wrote: Hi, I would like to introduce an E_NOTICE when an array is silently converted to a string. This isn't ver

Re: [PHP-DEV] [PATCH] Notice on array to string convertion

2011-06-02 Thread Patrick ALLAERT
2011/6/2 Rune Kaagaard : >> this conversion should never happen and throw a fatal error since this >> action is destructive to data and never useful nor will warnings/notices >> helps in the real world > > Unlike i.e. Python its really not the PHP way to go fatal on the > developer during weird typ

Re: [PHP-DEV] [PATCH] Notice on array to string convertion

2011-06-02 Thread Pierre Joye
hi, I like this for the current stable branch, no bc impact and gives a way to detect such mistakes (not ideal but better than nothing). Cheers, On Thu, Jun 2, 2011 at 12:11 PM, Patrick ALLAERT wrote: > Hi, > > I would like to introduce an E_NOTICE when an array is silently > converted to a str

Re: [PHP-DEV] [PATCH] Notice on array to string convertion

2011-06-02 Thread Patrick ALLAERT
2011/6/2 Hannes Magnusson : > How about making it useful rather then just throwing an notice? > Recursive implode maybe? Or json/php serialized? :) As already mentioned, that would be a much bigger BC break which would requires RFC, voting, ... Not that I am against, the thing is that it is diffi

RE: [PHP-DEV] [PATCH] Notice on array to string convertion

2011-06-02 Thread John Crenshaw
LeSueur [mailto:john.lesu...@gmail.com] Sent: Thursday, June 02, 2011 9:04 AM To: Reindl Harald Cc: internals@lists.php.net Subject: Re: [PHP-DEV] [PATCH] Notice on array to string convertion On Thu, Jun 2, 2011 at 6:24 AM, Reindl Harald wrote: > > > Am 02.06.2011 13:54, schrieb Hannes

Re: [PHP-DEV] [PATCH] Notice on array to string convertion

2011-06-02 Thread Marcel Esser
<3 yes please. Sent from my iBrain, powered by Panda. On Jun 2, 2011, at 6:19 AM, "Patrick ALLAERT" wrote: > Hi, > > 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 i

Re: [PHP-DEV] [PATCH] Notice on array to string convertion

2011-06-02 Thread Reindl Harald
Am 02.06.2011 15:04, schrieb John LeSueur: > On Thu, Jun 2, 2011 at 6:24 AM, Reindl Harald wrote: > First, I agree that converting to json/imploding would be a bad idea. > There's no guarantee that the developer wanted to use the array in that way, > or even > that he wanted to use the array at

Re: [PHP-DEV] [PATCH] Notice on array to string convertion

2011-06-02 Thread John LeSueur
On Thu, Jun 2, 2011 at 6:24 AM, Reindl Harald wrote: > > > Am 02.06.2011 13:54, schrieb Hannes Magnusson: > > On Thu, Jun 2, 2011 at 12:11, Patrick ALLAERT > wrote: > >> Hi, > >> > >> I would like to introduce an E_NOTICE when an array is silently > >> converted to a string. > >> This isn't very

Re: [PHP-DEV] [PATCH] Notice on array to string convertion

2011-06-02 Thread Reindl Harald
Am 02.06.2011 14:56, schrieb Rune Kaagaard: >> this conversion should never happen and throw a fatal error since this >> action is destructive to data and never useful nor will warnings/notices >> helps in the real world > > Unlike i.e. Python its really not the PHP way to go fatal on the > deve

Re: [PHP-DEV] [PATCH] Notice on array to string convertion

2011-06-02 Thread Rune Kaagaard
> this conversion should never happen and throw a fatal error since this > action is destructive to data and never useful nor will warnings/notices > helps in the real world Unlike i.e. Python its really not the PHP way to go fatal on the developer during weird type conversions. I'm also +1 on the

Re: [PHP-DEV] [PATCH] Notice on array to string convertion

2011-06-02 Thread Reindl Harald
Am 02.06.2011 13:54, schrieb Hannes Magnusson: > On Thu, Jun 2, 2011 at 12:11, Patrick ALLAERT wrote: >> Hi, >> >> 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

Re: [PHP-DEV] [PATCH] Notice on array to string convertion

2011-06-02 Thread Gustavo Lopes
Em Thu, 02 Jun 2011 12:54:10 +0100, Hannes Magnusson escreveu: On Thu, Jun 2, 2011 at 12:11, Patrick ALLAERT 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 m

Re: [PHP-DEV] [PATCH] Notice on array to string convertion

2011-06-02 Thread Hannes Landeholm
I don't there's a good general case for this. I'd +1 on throwing E_NOTICE. Hannes On 2 June 2011 13:54, Hannes Magnusson wrote: > > How about making it useful rather then just throwing an notice? > Recursive implode maybe? Or json/php serialized? :) > > -Hannes > > -- > PHP Internals - PHP Runt

Re: [PHP-DEV] [PATCH] Notice on array to string convertion

2011-06-02 Thread Hannes Magnusson
On Thu, Jun 2, 2011 at 12:11, Patrick ALLAERT wrote: > Hi, > > 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. How abou

[PHP-DEV] [PATCH] Notice on array to string convertion

2011-06-02 Thread Patrick ALLAERT
Hi, 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. Patch implementing that behavior change:

Re: [PHP-DEV] [PATCH] Notice on array to string convertion

2011-06-02 Thread Reindl Harald
Am 02.06.2011 12:19, schrieb Patrick ALLAERT: > I would like to introduce an E_NOTICE when an array is silently > converted to a string. what is new? a fatal error would be better here error_reporting = E_ALL | E_STRICT google: "Notice: Array to string conversion" signature.asc Description: Op

Re: [PHP-DEV] [PATCH] Notice on array to string convertion

2011-06-02 Thread Alain Williams
On Thu, Jun 02, 2011 at 12:19:36PM +0200, Patrick ALLAERT wrote: > Hi, > > 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

[PHP-DEV] [PATCH] Notice on array to string convertion

2011-06-02 Thread Patrick ALLAERT
Hi, 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. Patch implementing that behavior change: