And rename charset to encoding, including inside error messages.
Closes GH-6234.
break;
case PHP_ICONV_ERR_WRONG_CHARSET:
- php_error_docref(NULL, E_WARNING, "Wrong charset, conversion from \"%s\" to \"%s\" is not allowed",
+ php_error_docref(NULL, E_WARNING, "Wrong encoding, conversion from \"%s\" to \"%s\" is not allowed",
in_charset, out_charset);
break;
if (charset == NULL) {
charset = get_internal_encoding();
} else if (charset_len >= ICONV_CSNMAXLEN) {
- php_error_docref(NULL, E_WARNING, "Charset parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN);
+ php_error_docref(NULL, E_WARNING, "Encoding parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN);
RETURN_FALSE;
}
if (charset == NULL) {
charset = get_internal_encoding();
} else if (charset_len >= ICONV_CSNMAXLEN) {
- php_error_docref(NULL, E_WARNING, "Charset parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN);
+ php_error_docref(NULL, E_WARNING, "Encoding parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN);
RETURN_FALSE;
}
if (charset == NULL) {
charset = get_internal_encoding();
} else if (charset_len >= ICONV_CSNMAXLEN) {
- php_error_docref(NULL, E_WARNING, "Charset parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN);
+ php_error_docref(NULL, E_WARNING, "Encoding parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN);
RETURN_FALSE;
}
if (charset == NULL) {
charset = get_internal_encoding();
} else if (charset_len >= ICONV_CSNMAXLEN) {
- php_error_docref(NULL, E_WARNING, "Charset parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN);
+ php_error_docref(NULL, E_WARNING, "Encoding parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN);
RETURN_FALSE;
}
if ((pzval = zend_hash_str_find_deref(Z_ARRVAL_P(pref), "input-charset", sizeof("input-charset") - 1)) != NULL && Z_TYPE_P(pzval) == IS_STRING) {
if (Z_STRLEN_P(pzval) >= ICONV_CSNMAXLEN) {
- php_error_docref(NULL, E_WARNING, "Charset parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN);
+ php_error_docref(NULL, E_WARNING, "Encoding parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN);
RETURN_FALSE;
}
if ((pzval = zend_hash_str_find_deref(Z_ARRVAL_P(pref), "output-charset", sizeof("output-charset") - 1)) != NULL && Z_TYPE_P(pzval) == IS_STRING) {
if (Z_STRLEN_P(pzval) >= ICONV_CSNMAXLEN) {
- php_error_docref(NULL, E_WARNING, "Charset parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN);
+ php_error_docref(NULL, E_WARNING, "Encoding parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN);
RETURN_FALSE;
}
if (charset == NULL) {
charset = get_internal_encoding();
} else if (charset_len >= ICONV_CSNMAXLEN) {
- php_error_docref(NULL, E_WARNING, "Charset parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN);
+ php_error_docref(NULL, E_WARNING, "Encoding parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN);
RETURN_FALSE;
}
if (charset == NULL) {
charset = get_internal_encoding();
} else if (charset_len >= ICONV_CSNMAXLEN) {
- php_error_docref(NULL, E_WARNING, "Charset parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN);
+ php_error_docref(NULL, E_WARNING, "Encoding parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN);
RETURN_FALSE;
}
}
if (in_charset_len >= ICONV_CSNMAXLEN || out_charset_len >= ICONV_CSNMAXLEN) {
- php_error_docref(NULL, E_WARNING, "Charset parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN);
+ php_error_docref(NULL, E_WARNING, "Encoding parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN);
RETURN_FALSE;
}
}
if (ZSTR_LEN(charset) >= ICONV_CSNMAXLEN) {
- php_error_docref(NULL, E_WARNING, "Charset parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN);
+ php_error_docref(NULL, E_WARNING, "Encoding parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN);
RETURN_FALSE;
}
/** @generate-function-entries */
-function iconv_strlen(string $str, ?string $charset = null): int|false {}
+function iconv_strlen(string $string, ?string $encoding = null): int|false {}
-function iconv_substr(string $str, int $offset, ?int $length = null, ?string $charset = null): string|false {}
+function iconv_substr(string $string, int $offset, ?int $length = null, ?string $encoding = null): string|false {}
-function iconv_strpos(string $haystack, string $needle, int $offset = 0, ?string $charset = null): int|false {}
+function iconv_strpos(string $haystack, string $needle, int $offset = 0, ?string $encoding = null): int|false {}
-function iconv_strrpos(string $haystack, string $needle, ?string $charset = null): int|false {}
+function iconv_strrpos(string $haystack, string $needle, ?string $encoding = null): int|false {}
-function iconv_mime_encode(string $field_name, string $field_value, array $preference = []): string|false {}
+function iconv_mime_encode(string $field_name, string $field_value, array $options = []): string|false {}
-function iconv_mime_decode(string $encoded_string, int $mode = 0, ?string $charset = null): string|false {}
+function iconv_mime_decode(string $string, int $mode = 0, ?string $encoding = null): string|false {}
-function iconv_mime_decode_headers(string $headers, int $mode = 0, ?string $charset = null): array|false {}
+function iconv_mime_decode_headers(string $headers, int $mode = 0, ?string $encoding = null): array|false {}
-function iconv(string $in_charset, string $out_charset, string $str): string|false {}
+function iconv(string $from_encoding, string $to_encoding, string $string): string|false {}
-function iconv_set_encoding(string $type, string $charset): bool {}
+function iconv_set_encoding(string $type, string $encoding): bool {}
function iconv_get_encoding(string $type = "all"): array|string|false {}
/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: 4e26168b04450adf510a4e638184c46757679ac1 */
+ * Stub hash: 5d05deb60466c6e1ee73b44ad0b09a032bc8410e */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_iconv_strlen, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
- ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
- ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, charset, IS_STRING, 1, "null")
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_STRING, 1, "null")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_iconv_substr, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
- ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 1, "null")
- ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, charset, IS_STRING, 1, "null")
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_STRING, 1, "null")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_iconv_strpos, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, haystack, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, needle, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, offset, IS_LONG, 0, "0")
- ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, charset, IS_STRING, 1, "null")
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_STRING, 1, "null")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_iconv_strrpos, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, haystack, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, needle, IS_STRING, 0)
- ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, charset, IS_STRING, 1, "null")
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_STRING, 1, "null")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_iconv_mime_encode, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, field_name, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, field_value, IS_STRING, 0)
- ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, preference, IS_ARRAY, 0, "[]")
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 0, "[]")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_iconv_mime_decode, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
- ZEND_ARG_TYPE_INFO(0, encoded_string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "0")
- ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, charset, IS_STRING, 1, "null")
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_STRING, 1, "null")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_iconv_mime_decode_headers, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, headers, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "0")
- ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, charset, IS_STRING, 1, "null")
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_STRING, 1, "null")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_iconv, 0, 3, MAY_BE_STRING|MAY_BE_FALSE)
- ZEND_ARG_TYPE_INFO(0, in_charset, IS_STRING, 0)
- ZEND_ARG_TYPE_INFO(0, out_charset, IS_STRING, 0)
- ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, from_encoding, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, to_encoding, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_iconv_set_encoding, 0, 2, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, type, IS_STRING, 0)
- ZEND_ARG_TYPE_INFO(0, charset, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_iconv_get_encoding, 0, 0, MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_FALSE)
var_dump(iconv("x", $a, "test"));
?>
--EXPECTF--
-Warning: iconv(): Charset parameter exceeds the maximum allowed length of %d characters in %s on line %d
+Warning: iconv(): Encoding parameter exceeds the maximum allowed length of 64 characters in %s on line %d
bool(false)
-Warning: iconv(): Charset parameter exceeds the maximum allowed length of %d characters in %s on line %d
+Warning: iconv(): Encoding parameter exceeds the maximum allowed length of 64 characters in %s on line %d
bool(false)
var_dump(iconv_mime_decode("a", null, $a));
?>
--EXPECTF--
-Warning: iconv_mime_decode(): Charset parameter exceeds the maximum allowed length of %d characters in %s on line %d
+Warning: iconv_mime_decode(): Encoding parameter exceeds the maximum allowed length of 64 characters in %s on line %d
bool(false)
var_dump(iconv_mime_decode_headers("a", null, $a));
?>
--EXPECTF--
-Warning: iconv_mime_decode_headers(): Charset parameter exceeds the maximum allowed length of %d characters in %s on line %d
+Warning: iconv_mime_decode_headers(): Encoding parameter exceeds the maximum allowed length of 64 characters in %s on line %d
bool(false)
var_dump(iconv_set_encoding("internal_encoding", $a));
?>
--EXPECTF--
-Warning: iconv_set_encoding(): Charset parameter exceeds the maximum allowed length of %d characters in %s on line %d
+Warning: iconv_set_encoding(): Encoding parameter exceeds the maximum allowed length of 64 characters in %s on line %d
bool(false)
-Warning: iconv_set_encoding(): Charset parameter exceeds the maximum allowed length of %d characters in %s on line %d
+Warning: iconv_set_encoding(): Encoding parameter exceeds the maximum allowed length of 64 characters in %s on line %d
bool(false)
-Warning: iconv_set_encoding(): Charset parameter exceeds the maximum allowed length of %d characters in %s on line %d
+Warning: iconv_set_encoding(): Encoding parameter exceeds the maximum allowed length of 64 characters in %s on line %d
bool(false)
var_dump(iconv_strlen(1, $a));
?>
--EXPECTF--
-Warning: iconv_strlen(): Charset parameter exceeds the maximum allowed length of %d characters in %s on line %d
+Warning: iconv_strlen(): Encoding parameter exceeds the maximum allowed length of 64 characters in %s on line %d
bool(false)
--EXPECTF--
*** Testing iconv_strlen() : error ***
-Warning: iconv_strlen(): Wrong charset, conversion from "unknown-encoding" to "UCS-4LE" is not allowed in %s on line %d
+Warning: iconv_strlen(): Wrong encoding, conversion from "unknown-encoding" to "UCS-4LE" is not allowed in %s on line %d
bool(false)
var_dump(iconv_strpos("a", "b", 0, $a));
?>
--EXPECTF--
-Warning: iconv_strpos(): Charset parameter exceeds the maximum allowed length of %d characters in %s on line %d
+Warning: iconv_strpos(): Encoding parameter exceeds the maximum allowed length of 64 characters in %s on line %d
bool(false)
--EXPECTF--
*** Testing iconv_strpos() : error conditions ***
-Warning: iconv_strpos(): Wrong charset, conversion from "unknown-encoding" to "UCS-4LE" is not allowed in %s on line %d
+Warning: iconv_strpos(): Wrong encoding, conversion from "unknown-encoding" to "UCS-4LE" is not allowed in %s on line %d
bool(false)
Done
var_dump(iconv_strrpos("a", "b", $a));
?>
--EXPECTF--
-Warning: iconv_strrpos(): Charset parameter exceeds the maximum allowed length of %d characters in %s on line %d
+Warning: iconv_strrpos(): Encoding parameter exceeds the maximum allowed length of 64 characters in %s on line %d
bool(false)
--EXPECTF--
*** Testing iconv_strrpos() : error conditions ***
-Warning: iconv_strrpos(): Wrong charset, conversion from "unknown-encoding" to "UCS-4LE" is not allowed in %s on line %d
+Warning: iconv_strrpos(): Wrong encoding, conversion from "unknown-encoding" to "UCS-4LE" is not allowed in %s on line %d
bool(false)
Done
var_dump(iconv_substr($a, 0, 1, $b));
?>
--EXPECTF--
-Warning: iconv_substr(): Charset parameter exceeds the maximum allowed length of %d characters in %s on line %d
+Warning: iconv_substr(): Encoding parameter exceeds the maximum allowed length of 64 characters in %s on line %d
bool(false)
--EXPECTF--
*** Testing iconv_substr() : error conditions ***
-Warning: iconv_substr(): Wrong charset, conversion from "unknown-encoding" to "UCS-4LE" is not allowed in %s on line %d
+Warning: iconv_substr(): Wrong encoding, conversion from "unknown-encoding" to "UCS-4LE" is not allowed in %s on line %d
bool(false)
Done