Re: [PHP-DEV] How to detect classes with a count_elements handler in userland?

2016-11-17 Thread Joe Watkins
Afternoon, A change in convention makes sense, and sounds much nicer than hacking anything to make it work. I do prefer this approach to yet-another-function. Is changing convention all we would do though, or would we raise a warning when handler is present and interface is not ? Cheers Joe On

Re: [PHP-DEV] How to detect classes with a count_elements handler in userland?

2016-11-17 Thread Christoph M. Becker
On 16.11.2016 at 22:02, Nikita Popov wrote: > On Mon, Nov 14, 2016 at 2:22 PM, Christoph M. Becker > wrote: > >> On 13.11.2016 at 22:10, Craig Duncan wrote: >> How about just making those classes implement the interface instead? >>> >>> Christoph pointed out that there may be classes in ext

Re: [PHP-DEV] How to detect classes with a count_elements handler in userland?

2016-11-17 Thread Nikita Popov
On Thu, Nov 17, 2016 at 8:30 AM, Joe Watkins wrote: > Morning, > > Just to chime in ... can you split the PR into the RFC, and the new thing > please. > > Just another question on how we could make objects that have > count_elements (which is in object handlers) implement an interface on the > cl

Re: [PHP-DEV] How to detect classes with a count_elements handler in userland?

2016-11-17 Thread Craig Duncan
> > Just to chime in ... can you split the PR into the RFC, and the new thing > please. > Of course, that's done now: https://github.com/php/php-src/pull/2206

Re: [PHP-DEV] How to detect classes with a count_elements handler in userland?

2016-11-16 Thread Joe Watkins
Morning, Just to chime in ... can you split the PR into the RFC, and the new thing please. Just another question on how we could make objects that have count_elements (which is in object handlers) implement an interface on the class entry (which is detached from handlers) ? I'm sure it's doable,

Re: [PHP-DEV] How to detect classes with a count_elements handler in userland?

2016-11-16 Thread Nikita Popov
On Mon, Nov 14, 2016 at 2:22 PM, Christoph M. Becker wrote: > On 13.11.2016 at 22:10, Craig Duncan wrote: > > >> How about just making those classes implement the interface instead? > > > > Christoph pointed out that there may be classes in extensions that use > > count_elements. > > Furthermore,

Re: [PHP-DEV] How to detect classes with a count_elements handler in userland?

2016-11-14 Thread Christoph M. Becker
On 13.11.2016 at 22:10, Craig Duncan wrote: >> How about just making those classes implement the interface instead? > > Christoph pointed out that there may be classes in extensions that use > count_elements. Furthermore, letting those classes implement Countable could break BC. > Also it would

Re: [PHP-DEV] How to detect classes with a count_elements handler in userland?

2016-11-13 Thread Craig Duncan
> How about just making those classes implement the interface instead? Christoph pointed out that there may be classes in extensions that use count_elements. Also it would make userland code simpler: is_countable($thing) vs is_array($thing) || $thing implements \Countable

Re: [PHP-DEV] How to detect classes with a count_elements handler in userland?

2016-11-13 Thread Niklas Keller
2016-11-13 18:34 GMT+01:00 Christoph M. Becker : > Hi! > > In the discussion on PR #2185[1] we've stumbled upon the issue of > internal classes implementing a count_elements handler (but not the > Countable interface). > > Is it possible to detect this in userland? If not, I would suggest that >

[PHP-DEV] How to detect classes with a count_elements handler in userland?

2016-11-13 Thread Christoph M. Becker
Hi! In the discussion on PR #2185[1] we've stumbled upon the issue of internal classes implementing a count_elements handler (but not the Countable interface). Is it possible to detect this in userland? If not, I would suggest that we introduce something like is_countable(), so users can check w