Skip to content

Commit 9841f6f

Browse files
bug #119 Update is_countable to include countable objects that doesn'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
2 parents b2c0420 + 6adf5c5 commit 9841f6f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

bootstrap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111

1212
if (PHP_VERSION_ID < 70300) {
1313
if (!function_exists('is_countable')) {
14-
function is_countable($var) { return is_array($var) || $var instanceof Countable; }
14+
function is_countable($var) { return is_array($var) || $var instanceof Countable || $var instanceof ResourceBundle || $var instanceof SimpleXmlElement; }
1515
}
1616
}

0 commit comments

Comments
 (0)