Re: fix bug #53432 (Assignment via string index access on an empty string converts to array)
Hi Nikita,
On Thu, Nov 21, 2013 at 12:26 AM, Nikita Popov <nikita.ppv@gmail.com> wrote:
> The current behavior is that anything "falsey" (e.g. null, false and the
> empty string) is silently cast to array when an array operation is applied
> to it. I don't like that behavior, but it's somewhat internally consistent
> now. Changing it for strings *only* seems a bit weird.
Persuasive argument.
I prefer to change the behavior if I have to choose, though.
$a = ''; // empty string
$a[10] = 'a';
echo $a; // "Array"
would be common pit hole when users are trying to use string as array of
chars.
I don't know why, but there are 436 FB likes! for this PR even if there is
no "likes!"
button on the page. There may be a lot of users that are unhappy with this
behavior.
Document and warn users?
Or should we change behavior even if it seems odd?
I don't mind at all setting up RFC to vote.
Any comments?
--
Yasuo Ohgaki
yohgaki@ohgaki.net
Thread (10 messages)