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.net>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 all instead of some element inside the
>> array.
>
> and the dveloper surely wanted NOT write destroyed data somewhere

Yes, but we also don't want to break BC.

>> Instead, this is an indication that you're probably doing something wrong.
>
> leave the world "probably" out
>
>> However, fatal errors should be reserved for when the engine cannot
>> continue.
>
> the engine can not continue anything useful after passing
> an array to a string function

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 which is even worst.

Not only this wouldn't be a huge BC break, this would also lead to
some incoherence. For now, if you are using:
$x = array();
join( $x, array( "element1", "element2") );

This will already generate a notice:
Notice: Array to string conversion in ... on line ...

This would lead to two choice:
1. Be incoherent (with the rest of the code and the philosophy of PHP)
2. Be coherent and make all those functions already generating a
notice be an error. That would be even a much much much larger BC
break.

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to