1--TEST-- 2Test count() function : invalid modes in weak type mode 3--FILE-- 4<?php 5 6$modes = [ 7 COUNT_NORMAL, 8 COUNT_RECURSIVE, 9 0, 10 1, 11 -1, 12 2, 13 TRUE, 14 FALSE, 15]; 16 17foreach ($modes as $mode) { 18 try { 19 var_dump(count([], $mode)); 20 } catch (\ValueError $error) { 21 echo $error->getMessage() . \PHP_EOL; 22 } 23} 24?> 25--EXPECT-- 26int(0) 27int(0) 28int(0) 29int(0) 30count(): Argument #2 ($mode) must be either COUNT_NORMAL or COUNT_RECURSIVE 31count(): Argument #2 ($mode) must be either COUNT_NORMAL or COUNT_RECURSIVE 32int(0) 33int(0) 34