Re: [RFC] Generalize support of negative string offsets
| From: | François Laupretre | Date: | Wed, 10 Feb 2016 14:42:19 +0000 |
| Subject: | Re: [RFC] Generalize support of negative string offsets | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-91184@lists.php.net to get a copy of this message | ||
Le 10/02/2016 15:34, Dan Ackroyd a écrit :
On 10 February 2016 at 07:00, Yasuo Ohgaki <yohgaki@ohgaki.net> wrote:Sure. All of this is interesting, but out of scope for this RFC. My initial question was just about the fact that empty strings are not handled like other strings, regarding offset assignments (empty strings are silently converted to arrays). Regards FrançoisAdditional comment on this php > $v=array(1,2,3); php > $v .= 'abc'; I think $v .= 'abc' should not destroy array variable. It's minor issue, though.That is the current behaviour. Trying to slip "bug fixes" into RFCs is a very bad pattern to follow. If this should be fixed, it should be done as part of a separate RFC.This insane string assignment raises E_NOTICE. PHP may be better to raise E_WARNING for this kind of invalid assignments just likeFrançois already wrote an RFC for this https://wiki.php.net/rfc/array-to-string that passed, but apparently could not be implemented safely, which is a shame. That RFC needs to be resurrected imo. But again, changing that behaviour needs to be separate, and not part of this RFC.