1--TEST--
2str_word_count() and invalid arguments
3--FILE--
4<?php
5
6var_dump(str_word_count(""));
7
8try {
9    var_dump(str_word_count("", -1));
10} catch (\ValueError $e) {
11    echo $e->getMessage() . "\n";
12}
13
14try {
15    var_dump(str_word_count("", -1, $a));
16} catch (\ValueError $e) {
17    echo $e->getMessage() . "\n";
18}
19
20var_dump($a);
21?>
22--EXPECTF--
23int(0)
24str_word_count(): Argument #2 ($format) must be a valid format value
25
26Warning: Undefined variable $a in %s on line %d
27str_word_count(): Argument #2 ($format) must be a valid format value
28
29Warning: Undefined variable $a in %s on line %d
30NULL
31