Re: fix bug #53432 (Assignment via string index access on an empty string converts to array)
| From: | Yasuo Ohgaki | Date: | Wed, 20 Nov 2013 22:02:05 +0000 |
| Subject: | Re: fix bug #53432 (Assignment via string index access on an empty string converts to array) | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-70253@lists.php.net to get a copy of this message | ||
Hi Andrea,
On Thu, Nov 21, 2013 at 6:53 AM, Andrea Faulds <ajf@ajf.me> wrote:
> On 20/11/13 21:49, Andrea Faulds wrote:
>
>>
>> Just my 2 cents, but that definitely looks like a situation that might
>> crop up in real code unintentionally, and it violates the Principle of
>> Least Astonishment IMO. Consider a hypothetical function which returns a
>> modified string. If we've ended up with an empty string being passed
>> into it, then it suddenly returning an Array is not what you expect, and
>> might horribly break code that assumes the result won't be a string.
>>
>>
> Oh dear Andrea, you should proofread your emails better.
> s/won't be/will be
I agree with your discussion and that's the reason why I sending
this PR before I said "it's the spec".
I've added this behavior to RFC (NOT for voting)
https://wiki.php.net/rfc/comparison_inconsistency?&#conversioncomparison
I'm gathering these kind of PHP behaviors. If you have one, please let me
know so that I can add issues in the wiki page. (Or even better, please add
one to the page)
Thank you.
--
Yasuo Ohgaki
yohgaki@ohgaki.net