Skip to content

Commit 7acc345

Browse files
committed
bug symfony#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 ------- 635bccd Dont call count on non countable object
2 parents 73e9348 + 635bccd commit 7acc345

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/Symfony/Component/Translation/Dumper/IcuResFileDumper.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function format(MessageCatalogue $messages, $domain = 'messages')
5252

5353
$resOffset = $this->getPosition($data);
5454

55-
$data .= pack('v', count($messages))
55+
$data .= pack('v', count($messages->all($domain)))
5656
.$indexes
5757
.$this->writePadding($data)
5858
.$resources
@@ -63,11 +63,11 @@ public function format(MessageCatalogue $messages, $domain = 'messages')
6363
$root = pack('V7',
6464
$resOffset + (2 << 28), // Resource Offset + Resource Type
6565
6, // Index length
66-
$keyTop, // Index keys top
67-
$bundleTop, // Index resources top
68-
$bundleTop, // Index bundle top
69-
count($messages), // Index max table length
70-
0 // Index attributes
66+
$keyTop, // Index keys top
67+
$bundleTop, // Index resources top
68+
$bundleTop, // Index bundle top
69+
count($messages->all($domain)), // Index max table length
70+
0 // Index attributes
7171
);
7272

7373
$header = pack('vC2v4C12@32',

0 commit comments

Comments
 (0)