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 the

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 application.

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-03 Thread Ferenc Kovacs
On Fri, Jun 3, 2011 at 1:05 AM, Arvids Godjuks arvids.godj...@gmail.comwrote: +1 on E_NOTICE 02.06.2011 19:13 пользователь Ilia Alshanetsky i...@prohost.org написал: I like the idea of an error message when this happens, but as few other people in the thread had mentioned, I think it

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 string).

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

2011-06-03 Thread Patrick ALLAERT
2011/6/2 Ilia Alshanetsky i...@prohost.org: 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).

[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 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.

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:

[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 Hannes Magnusson
On Thu, Jun 2, 2011 at 12:11, Patrick ALLAERT patrickalla...@php.net 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

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 hannes.magnus...@gmail.com wrote: How about making it useful rather then just throwing an notice? Recursive implode maybe? Or json/php serialized? :) -Hannes -- PHP

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 hannes.magnus...@gmail.com escreveu: On Thu, Jun 2, 2011 at 12:11, Patrick ALLAERT patrickalla...@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

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 patrickalla...@php.net 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:

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 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 developer

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 h.rei...@thelounge.netwrote: Am 02.06.2011 13:54, schrieb Hannes Magnusson: On Thu, Jun 2, 2011 at 12:11, Patrick ALLAERT patrickalla...@php.net wrote: Hi, I would like to introduce an E_NOTICE when an array is silently converted to a

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 h.rei...@thelounge.netwrote: 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

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 patrick.alla...@gmail.com 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

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 h.rei...@thelounge.netwrote: Am 02.06.2011 13:54, schrieb

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

2011-06-02 Thread Patrick ALLAERT
2011/6/2 Hannes Magnusson hannes.magnus...@gmail.com: 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

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 patrickalla...@php.net wrote: Hi, I would like to introduce an E_NOTICE when an array is silently

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

2011-06-02 Thread Patrick ALLAERT
2011/6/2 Rune Kaagaard rumi...@gmail.com: 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

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 ALLAERTpatrickalla...@php.net wrote: Hi, I would like to introduce an E_NOTICE when an array is silently converted to a

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

2011-06-02 Thread Patrick ALLAERT
2011/6/2 Reindl Harald h.rei...@thelounge.net: Am 02.06.2011 15:04, schrieb John LeSueur: On Thu, Jun 2, 2011 at 6:24 AM, Reindl Harald h.rei...@thelounge.netwrote: First, I agree that converting to json/imploding would be a bad idea. There's no guarantee that the developer wanted to use the

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

2011-06-02 Thread Patrick ALLAERT
2011/6/2 Brian Moon br...@moonspot.net: 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 ALLAERTpatrickalla...@php.net  wrote: Hi, I would like to introduce an

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 would break BC

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:

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 br...@moonspot.net 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 ALLAERTpatrickalla...@php.net wrote: Hi, I

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 patrick.alla...@gmail.com 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

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

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 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

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

2011-06-02 Thread Peter Lind
On 2 June 2011 16:50, Reindl Harald h.rei...@thelounge.net 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

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 redesign

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 makes

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 h.rei...@thelounge.net 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,

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,

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 h.rei...@thelounge.net 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 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

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 Patrick ALLAERT
2011/6/2 Reindl Harald h.rei...@thelounge.net: 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

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 ALLAERT