How to detect classes with a count_elements handler in userland?
| From: | Christoph M. Becker | Date: | Sun, 13 Nov 2016 17:34:48 +0000 |
| Subject: | How to detect classes with a count_elements handler in userland? | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-96875@lists.php.net to get a copy of this message | ||
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 whether
count() may be safely called on a given value.
[1] <https://github.com/php/php-src/pull/2185>
--
Christoph M. Becker