Re: Possibilities to fix some really poor behaviors in PHP7
| From: | Stas Malyshev | Date: | Tue, 14 Oct 2014 07:25:30 +0000 |
| Subject: | Re: Possibilities to fix some really poor behaviors in PHP7 | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-77949@lists.php.net to get a copy of this message | ||
Hi!
> ... like the hidden array element: http://3v4l.org/6uFqf
> ... like the hidden object property: http://3v4l.org/RPJXH
The issue seems to be that array lookup always looks for numeric results
when looking for numeric-like keys. But when adding property, the
numeric check is not done since properties are not supposed to be
numeric. Thus, when converting the object to array, the property named
"123" becomes inaccessible, because in array it is supposed to be under
number 123.
We could, of course, add numeric checks to properties, but it would slow
things down only to serve very narrow use case with hardly any legit
uses. We could also rewrite hashtable with numeric keys instead of
string keys when doing conversion, but again that would be significant
slowdown for a very rare use case. Not sure it's worth it.
--
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/