Re: array_key_exists BC break

From: Date: Thu, 06 Nov 2008 18:29:13 +0000
Subject: Re: array_key_exists BC break
References: 1 2 3 4 5 6 7 8 9 10 11 12 13  Groups: php.internals 
Request: Send a blank email to internals+get-41735@lists.php.net to get a copy of this message
Em Qui, 2008-11-06 às 10:10 -0800, Stanislav Malyshev escreveu: > Hi! > > > So as suggested and wished, here is a patch that add a modifier '%' to > > 'a' in parameter parsing API, where it allows object that implements > > ArrayAccess to be accept. Although it doesn't invoke any their methods, > > i.e. just how it works nowdays. > > I think if you use HASH_OF then any object having get_properties should > be fine... Is there any reason to restrict it to ArrayAccess? Well, there is no reason, I was only following what was said. It would make more sense in case of real BC break avoiding. > > A list of functions that allow object on current 5.2: > > . uksort > > . uasort > > . usort > > . natcasesort > > . natsort > > Interestingly, this list includes no sort(). Is it intentional? Also, we > have a bunch of array functions - wouldn't it make sense that all of > them behaved the same way towards objects? Yep, this was really interesting, see: $x = new stdclass; $x->foo = 1; sort($x); Warning: sort() expects parameter 1 to be array, object given ... As other functions that I guess you must be remembered. :) And yes, I have checked each array function. -- Regards, Felipe Pena

« previous php.internals (#41735) next »