Skip to content

Commit 6390158

Browse files
committed
Deprecate calling mb_check_encoding() without argument
Part of https://wiki.php.net/rfc/deprecations_php_8_1.
1 parent dcc8463 commit 6390158

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

UPGRADING

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,10 @@ PHP 8.1 UPGRADE NOTES
337337
favor of date_sun_info().
338338
RFC: https://wiki.php.net/rfc/deprecations_php_8_1
339339

340+
- Mbstring:
341+
. Calling mb_check_encoding() without an argument is deprecated.
342+
RFC: https://wiki.php.net/rfc/deprecations_php_8_1
343+
340344
- MySQLi:
341345
. The mysqli_driver::$driver_version property has been deprecated. The driver
342346
version is meaningless as it hasn't been updated in more than a decade. Use

ext/mbstring/mbstring.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3953,6 +3953,9 @@ PHP_FUNCTION(mb_check_encoding)
39533953
} else if (input_str) {
39543954
RETURN_BOOL(php_mb_check_encoding(ZSTR_VAL(input_str), ZSTR_LEN(input_str), encoding));
39553955
} else {
3956+
php_error_docref(NULL, E_DEPRECATED,
3957+
"Calling mb_check_encoding() without argument is deprecated");
3958+
39563959
/* FIXME: Actually check all inputs, except $_FILES file content. */
39573960
RETURN_BOOL(MBSTRG(illegalchars) == 0);
39583961
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
--TEST--
2+
Calling mb_check_encoding() without argument is deprecated
3+
--EXTENSIONS--
4+
mbstring
5+
--FILE--
6+
<?php
7+
8+
var_dump(mb_check_encoding());
9+
10+
?>
11+
--EXPECTF--
12+
Deprecated: mb_check_encoding(): Calling mb_check_encoding() without argument is deprecated in %s on line %d
13+
bool(true)

0 commit comments

Comments
 (0)