mirror of
https://github.com/php/php-src.git
synced 2026-03-24 16:22:37 +01:00
28 lines
611 B
PHP
28 lines
611 B
PHP
--TEST--
|
|
Test mb_substr() function : error conditions - Pass an unknown encoding
|
|
--EXTENSIONS--
|
|
mbstring
|
|
--FILE--
|
|
<?php
|
|
/*
|
|
* Pass an unknown encoding to mb_substr() to test behaviour
|
|
*/
|
|
|
|
echo "*** Testing mb_substr() : error conditions ***\n";
|
|
|
|
$str = 'Hello, world';
|
|
$start = 1;
|
|
$length = 5;
|
|
$encoding = 'unknown-encoding';
|
|
|
|
try {
|
|
var_dump( mb_substr($str, $start, $length, $encoding));
|
|
} catch (\ValueError $e) {
|
|
echo $e->getMessage() . \PHP_EOL;
|
|
}
|
|
|
|
?>
|
|
--EXPECT--
|
|
*** Testing mb_substr() : error conditions ***
|
|
mb_substr(): Argument #4 ($encoding) must be a valid encoding, "unknown-encoding" given
|