1--TEST--
2Test mb_substr_count() function : error conditions - pass unknown encoding
3--SKIPIF--
4<?php
5extension_loaded('mbstring') or die('skip');
6function_exists('mb_substr_count') or die("skip mb_substr_count() is not available in this build");
7?>
8--FILE--
9<?php
10/* Prototype  : int mb_substr_count(string $haystack, string $needle [, string $encoding])
11 * Description: Count the number of substring occurrences
12 * Source code: ext/mbstring/mbstring.c
13 */
14
15/*
16 * Test behaviour of mb_substr_count() function when passed an unknown encoding
17 */
18
19echo "*** Testing mb_substr_count() : error conditions ***\n";
20
21$haystack = 'Hello, World!';
22$needle = 'Hello';
23$encoding = 'unknown-encoding';
24
25echo "\n-- Testing mb_substr_count() function with an unknown encoding --\n";
26var_dump(mb_substr_count($haystack, $needle, $encoding));
27
28echo "Done";
29?>
30--EXPECTF--
31*** Testing mb_substr_count() : error conditions ***
32
33-- Testing mb_substr_count() function with an unknown encoding --
34
35Warning: mb_substr_count(): Unknown encoding "unknown-encoding" in %s on line %d
36bool(false)
37Done
38