diff options
author | George Peter Banyard <girgias@php.net> | 2020-03-28 20:31:18 +0100 |
---|---|---|
committer | George Peter Banyard <girgias@php.net> | 2020-03-31 16:34:18 +0200 |
commit | 90eeca2531296648a264f3fdc9a3e7e8e281b24e (patch) | |
tree | 5fbea594100c996722c77c6e88350abef239559d /ext/mbstring/tests/mb_strrchr_error2.phpt | |
parent | 55a3e5b99e35a99fe5916a761df87ea269d0b959 (diff) | |
download | php-git-90eeca2531296648a264f3fdc9a3e7e8e281b24e.tar.gz |
Convert some unknown encoding warnings to ValueErrors in ext/mbstring
Promotes only the warnings where the encoding comes only from a string.
Functions which accept an array of encodings will be fixed at a later stage.
Closes GH-5317
Diffstat (limited to 'ext/mbstring/tests/mb_strrchr_error2.phpt')
-rw-r--r-- | ext/mbstring/tests/mb_strrchr_error2.phpt | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/ext/mbstring/tests/mb_strrchr_error2.phpt b/ext/mbstring/tests/mb_strrchr_error2.phpt index 35ca2c811f..ec75579213 100644 --- a/ext/mbstring/tests/mb_strrchr_error2.phpt +++ b/ext/mbstring/tests/mb_strrchr_error2.phpt @@ -21,13 +21,16 @@ $haystack = 'Hello, world'; $needle = 'world'; $encoding = 'unknown-encoding'; $part = true; -var_dump( mb_strrchr($haystack, $needle, $part, $encoding) ); + +try { + var_dump( mb_strrchr($haystack, $needle, $part, $encoding) ); +} catch (\ValueError $e) { + echo $e->getMessage() . \PHP_EOL; +} ?> ---EXPECTF-- +--EXPECT-- *** Testing mb_strrchr() : error conditions *** -- Testing mb_strrchr() with unknown encoding -- - -Warning: mb_strrchr(): Unknown encoding "unknown-encoding" in %s on line %d -bool(false) +mb_strrchr(): Argument #4 ($encoding) must be a valid encoding, "unknown-encoding" given |