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 -1.45, 13 2, 14 TRUE, 15 FALSE, 16 NULL, 17]; 18 19foreach ($modes as $mode) { 20 try { 21 var_dump(count([], $mode)); 22 } catch (\ValueError $error) { 23 echo $error->getMessage() . \PHP_EOL; 24 } 25} 26?> 27--EXPECT-- 28int(0) 29int(0) 30int(0) 31int(0) 32count(): Argument #2 ($mode) must be either COUNT_NORMAL or COUNT_RECURSIVE 33count(): Argument #2 ($mode) must be either COUNT_NORMAL or COUNT_RECURSIVE 34count(): Argument #2 ($mode) must be either COUNT_NORMAL or COUNT_RECURSIVE 35int(0) 36int(0) 37int(0) 38