Re: 5.4 regression: non-existent sub-sub keys now have values

From: Date: Thu, 24 Nov 2011 21:54:24 +0000
Subject: Re: 5.4 regression: non-existent sub-sub keys now have values
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-56598@lists.php.net to get a copy of this message
> > >> > Isn't it better to raise notice for accessing string by string index? >> > There is no use to allowing string index access to strings. I think >> > raising notice is feasible. Isn't it? >> >> String index access is still required since they are often numeric >> strings. We could add a notice for non-numeric strings, but the check >> would slow things down a bit. > > > yeah, as I mentioned before: > "The other improvement (related but not introduced in this change) that I > suggested was that we could also trigger a notice when a "non-applicable" > string offset is passed(defining non-applicable is a little bit hard, > because of the current type-juggling rules, we have to allow $string["1"], > because '1" can come from a database, or get/post, where it would be a > string, not an int, but if we go with the current type juggling, > $string["2_foo_3"] would also be converted to $string[2], which isn't > really intended imo. ." > > I would vote for allowing only numbers in the string index/offset: [0-9]+ > By "allowing" I meant that we should trigger the notice if the string index contains anything else than numbers. -- Ferenc Kovács @Tyr43l - http://tyrael.hu

« previous php.internals (#56598) next »