diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2013-03-14 05:42:27 +0000 |
---|---|---|
committer | <> | 2013-04-03 16:25:08 +0000 |
commit | c4dd7a1a684490673e25aaf4fabec5df138854c4 (patch) | |
tree | 4d57c44caae4480efff02b90b9be86f44bf25409 /ext/mbstring/tests/mb_substr_error2.phpt | |
download | php2-master.tar.gz |
Imported from /home/lorry/working-area/delta_php2/php-5.4.13.tar.bz2.HEADphp-5.4.13master
Diffstat (limited to 'ext/mbstring/tests/mb_substr_error2.phpt')
-rw-r--r-- | ext/mbstring/tests/mb_substr_error2.phpt | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/ext/mbstring/tests/mb_substr_error2.phpt b/ext/mbstring/tests/mb_substr_error2.phpt new file mode 100644 index 0000000..72be974 --- /dev/null +++ b/ext/mbstring/tests/mb_substr_error2.phpt @@ -0,0 +1,35 @@ +--TEST-- +Test mb_substr() function : error conditions - Pass an unknown encoding +--SKIPIF-- +<?php +extension_loaded('mbstring') or die('skip'); +function_exists('mb_substr') or die("skip mb_substr() is not available in this build"); +?> +--FILE-- +<?php +/* Prototype : string mb_substr(string $str, int $start [, int $length [, string $encoding]]) + * Description: Returns part of a string + * Source code: ext/mbstring/mbstring.c + */ + +/* + * 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'; + +var_dump( mb_substr($str, $start, $length, $encoding)); + +echo "Done"; +?> +--EXPECTF-- +*** Testing mb_substr() : error conditions *** + +Warning: mb_substr(): Unknown encoding "unknown-encoding" in %s on line %d +bool(false) +Done |