Re: array_key_exists BC break
| From: | Lukas Kahwe Smith | Date: | Sat, 15 Nov 2008 18:34:26 +0000 |
| Subject: | Re: array_key_exists BC break | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-41928@lists.php.net to get a copy of this message | ||
On 13.11.2008, at 19:19, Stanislav Malyshev wrote:
Hi!So what if we for now stick with the BC fix? However maybe for PHP 6.0 we should make a real effort to figure out how objects are supposed to be handled in our PHP type juggeling world. regards, Lukas Kahwe Smith mls@pooteeweet.orgCan anyone write up a summary of the situation and the options we have?Sure. A number of array functions in 5.2 accept arrays, but use HASH_OF to extract array value, which means they automatically accept objects if the object has working get_properties handler. In 5.3, such function use new API with 'a' parameter, which accepts only arrays proper. The proposal is to have some new parameter - say 'a%' - which would call HASH_OF on objects where it makes sense. The definition of "makes sense" is not clear yet, since, for example, sort() on some objects may make sense - if the object's get_properties returns real storage - or may not, if that handler returns the mere copy of the real data. We might use some interface as a marker - like ArrayAccess - though I'm not sure if it will work in all circumstances.