Re: fix bug #53432 (Assignment via string index access on an empty string converts to array)
| From: | Yasuo Ohgaki | Date: | Fri, 22 Nov 2013 00:27:23 +0000 |
| Subject: | Re: fix bug #53432 (Assignment via string index access on an empty string converts to array) | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-70270@lists.php.net to get a copy of this message | ||
Hi Stas,
It might be better to change RFC title.
My goal is sort out PHP behaviors which may seem strange.
If it's a bug, fix it. if not, document it so that users understand
what it suppose to do.
On Fri, Nov 22, 2013 at 4:49 AM, Stas Malyshev <smalyshev@sugarcrm.com>wrote:
> > I've added this behavior to RFC (NOT for voting)
> >
> > https://wiki.php.net/rfc/comparison_inconsistency?&#conversioncomparison
>
> I'm not sure behavior that is documented and implemented exactly as it
> was planned (e.g. min() behavior) can be called "inconsistency". It is
> actually completely consistent and does exactly what it is meant to do.
> Same for dec/hex strings - it works exactly like strtod(). Of course it
> does not support every numeric base in existence, but it was never
> supposed to.
>
I agree. It's the way PHP works.
It might be better to document these, since there are many languages out
there and people have different expectations.
> Also, "Null string is not handled as string" is not correct - null
> string is handled as string, except in one narrow case where you apply
> array operations to it. Right now it gives an impression empty strings
> are not handled as strings in PHP at all, which is not correct.
I've updated to
"Null string is handled as array" when string is accessed as array of char.
I appreciate better explanation :)
Regards,
--
Yasuo Ohgaki
yohgaki@ohgaki.net