Skip to content

Commit

Permalink
bug #119 Update is_countable to include countable objects that doesn'…
Browse files Browse the repository at this point in the history
…t implement \Countable (pierredup)

This PR was merged into the 1.8-dev branch.

Discussion
----------

Update is_countable to include countable objects that doesn't implement \Countable

Some objects are countable but don't implement `Countable` ([symfony/polyfill#115#issuecomment-384361414](symfony/polyfill#115 (comment)))

The objects that I could identify that is countable is `ResourceBundle` and `SimpleXmlElement`

Commits
-------

b53929e Update is_countable to include countable objects that doesn't implement \Countable
  • Loading branch information
nicolas-grekas committed Apr 26, 2018
2 parents b2c0420 + 6adf5c5 commit 9841f6f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@

if (PHP_VERSION_ID < 70300) {
if (!function_exists('is_countable')) {
function is_countable($var) { return is_array($var) || $var instanceof Countable; }
function is_countable($var) { return is_array($var) || $var instanceof Countable || $var instanceof ResourceBundle || $var instanceof SimpleXmlElement; }
}
}

0 comments on commit 9841f6f

Please sign in to comment.