From: Nikita Popov Date: Mon, 28 Sep 2020 10:51:03 +0000 (+0200) Subject: Throw warning for invalid iconv charset X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9e3f35269128f5f0a153c20dd0a74027cf86e879;p=php Throw warning for invalid iconv charset --- diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c index 1f3a141b3e..3a4399d350 100644 --- a/ext/iconv/iconv.c +++ b/ext/iconv/iconv.c @@ -1777,11 +1777,11 @@ static void _php_iconv_show_error(php_iconv_err_t err, const char *out_charset, break; case PHP_ICONV_ERR_CONVERTER: - php_error_docref(NULL, E_NOTICE, "Cannot open converter"); + php_error_docref(NULL, E_WARNING, "Cannot open converter"); break; case PHP_ICONV_ERR_WRONG_CHARSET: - php_error_docref(NULL, E_NOTICE, "Wrong charset, conversion from `%s' to `%s' is not allowed", + php_error_docref(NULL, E_WARNING, "Wrong charset, conversion from \"%s\" to \"%s\" is not allowed", in_charset, out_charset); break; diff --git a/ext/iconv/tests/iconv_strlen_error2.phpt b/ext/iconv/tests/iconv_strlen_error2.phpt index ea2bb430fb..98c784c414 100644 --- a/ext/iconv/tests/iconv_strlen_error2.phpt +++ b/ext/iconv/tests/iconv_strlen_error2.phpt @@ -23,5 +23,5 @@ var_dump(iconv_strlen($string, $encoding)); --EXPECTF-- *** Testing iconv_strlen() : error *** -Notice: iconv_strlen(): Wrong charset, conversion from `unknown-encoding' to `UCS-4LE' is not allowed in %s on line %d +Warning: iconv_strlen(): Wrong charset, conversion from "unknown-encoding" to "UCS-4LE" is not allowed in %s on line %d bool(false) diff --git a/ext/iconv/tests/iconv_strpos_error2.phpt b/ext/iconv/tests/iconv_strpos_error2.phpt index b95e1e1edc..48a8eff69b 100644 --- a/ext/iconv/tests/iconv_strpos_error2.phpt +++ b/ext/iconv/tests/iconv_strpos_error2.phpt @@ -24,6 +24,6 @@ echo "Done"; --EXPECTF-- *** Testing iconv_strpos() : error conditions *** -Notice: iconv_strpos(): Wrong charset, conversion from `unknown-encoding' to `UCS-4LE' is not allowed in %s on line %d +Warning: iconv_strpos(): Wrong charset, conversion from "unknown-encoding" to "UCS-4LE" is not allowed in %s on line %d bool(false) Done diff --git a/ext/iconv/tests/iconv_strrpos_error2.phpt b/ext/iconv/tests/iconv_strrpos_error2.phpt index 7b0155ac4d..4e9d925530 100644 --- a/ext/iconv/tests/iconv_strrpos_error2.phpt +++ b/ext/iconv/tests/iconv_strrpos_error2.phpt @@ -25,6 +25,6 @@ echo "Done"; --EXPECTF-- *** Testing iconv_strrpos() : error conditions *** -Notice: iconv_strrpos(): Wrong charset, conversion from `unknown-encoding' to `UCS-4LE' is not allowed in %s on line %d +Warning: iconv_strrpos(): Wrong charset, conversion from "unknown-encoding" to "UCS-4LE" is not allowed in %s on line %d bool(false) Done diff --git a/ext/iconv/tests/iconv_substr_error2.phpt b/ext/iconv/tests/iconv_substr_error2.phpt index 70a4e958c1..5da2d183fd 100644 --- a/ext/iconv/tests/iconv_substr_error2.phpt +++ b/ext/iconv/tests/iconv_substr_error2.phpt @@ -25,6 +25,6 @@ echo "Done"; --EXPECTF-- *** Testing iconv_substr() : error conditions *** -Notice: iconv_substr(): Wrong charset, conversion from `unknown-encoding' to `UCS-4LE' is not allowed in %s on line %d +Warning: iconv_substr(): Wrong charset, conversion from "unknown-encoding" to "UCS-4LE" is not allowed in %s on line %d bool(false) Done