bug #23279 Don't call count on non countable object (pierredup)

This PR was merged into the 2.7 branch.

Discussion
----------

Don't call count on non countable object

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | N/A
| License       | MIT
| Doc PR        |

From PHP 7.2, calling `count` on a non-countable object will emit a warning (https://wiki.php.net/rfc/counting_non_countables).
Based on the current test suit, this is the only place where I found this warning

Commits
-------

635bccdf8f Dont call count on non countable object
This commit is contained in:
Fabien Potencier 2017-06-24 09:42:08 -07:00
commit 7acc34537b

View File

@ -52,7 +52,7 @@ class IcuResFileDumper extends FileDumper
$resOffset = $this->getPosition($data);
$data .= pack('v', count($messages))
$data .= pack('v', count($messages->all($domain)))
.$indexes
.$this->writePadding($data)
.$resources
@ -63,11 +63,11 @@ class IcuResFileDumper extends FileDumper
$root = pack('V7',
$resOffset + (2 << 28), // Resource Offset + Resource Type
6, // Index length
$keyTop, // Index keys top
$bundleTop, // Index resources top
$bundleTop, // Index bundle top
count($messages), // Index max table length
0 // Index attributes
$keyTop, // Index keys top
$bundleTop, // Index resources top
$bundleTop, // Index bundle top
count($messages->all($domain)), // Index max table length
0 // Index attributes
);
$header = pack('vC2v4C12@32',