Skip to content

Commit a34e73d

Browse files
committed
mb_scrub() can't return false anymore
Also drop the intermediary function which was only used here
1 parent 07062e1 commit a34e73d

File tree

3 files changed

+4
-15
lines changed

3 files changed

+4
-15
lines changed

ext/mbstring/mbstring.c

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4424,14 +4424,7 @@ PHP_FUNCTION(mb_chr)
44244424
}
44254425
/* }}} */
44264426

4427-
4428-
static inline char* php_mb_scrub(const char* str, size_t str_len, const mbfl_encoding *enc, size_t *ret_len)
4429-
{
4430-
return php_mb_convert_encoding_ex(str, str_len, enc, enc, ret_len);
4431-
}
4432-
4433-
4434-
/* {{{ proto string|false mb_scrub([string str[, string encoding]]) */
4427+
/* {{{ proto string mb_scrub([string str[, string encoding]]) */
44354428
PHP_FUNCTION(mb_scrub)
44364429
{
44374430
const mbfl_encoding *enc;
@@ -4452,11 +4445,7 @@ PHP_FUNCTION(mb_scrub)
44524445
RETURN_THROWS();
44534446
}
44544447

4455-
ret = php_mb_scrub(str, str_len, enc, &ret_len);
4456-
4457-
if (ret == NULL) {
4458-
RETURN_FALSE;
4459-
}
4448+
ret = php_mb_convert_encoding_ex(str, str_len, enc, enc, &ret_len);
44604449

44614450
RETVAL_STRINGL(ret, ret_len);
44624451
efree(ret);

ext/mbstring/mbstring.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ function mb_get_info(string $type = UNKNOWN): array|string|int|false {}
8181

8282
function mb_check_encoding(array|string $var = UNKNOWN, string $encoding = UNKNOWN): bool {}
8383

84-
function mb_scrub(string $str, string $encoding = UNKNOWN): string|false {}
84+
function mb_scrub(string $str, string $encoding = UNKNOWN): string {}
8585

8686
function mb_ord(string $str, string $encoding = UNKNOWN): int|false {}
8787

ext/mbstring/mbstring_arginfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mb_check_encoding, 0, 0, _IS_BOO
193193
ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
194194
ZEND_END_ARG_INFO()
195195

196-
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mb_scrub, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
196+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mb_scrub, 0, 1, IS_STRING, 0)
197197
ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
198198
ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
199199
ZEND_END_ARG_INFO()

0 commit comments

Comments
 (0)