Skip to content

Commit 8c32deb

Browse files
committed
Don't check for impossible error condition in mb_strwidth
1 parent bf78070 commit 8c32deb

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

ext/mbstring/libmbfl/mbfl/mbfilter.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,10 +1250,7 @@ mbfl_strwidth(mbfl_string *string)
12501250
string->encoding,
12511251
&mbfl_encoding_wchar,
12521252
filter_count_width, 0, &len);
1253-
if (filter == NULL) {
1254-
mbfl_convert_filter_delete(filter);
1255-
return -1;
1256-
}
1253+
ZEND_ASSERT(filter);
12571254

12581255
/* feed data */
12591256
p = string->val;

ext/mbstring/mbstring.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2255,9 +2255,7 @@ PHP_FUNCTION(mb_strwidth)
22552255
RETURN_THROWS();
22562256
}
22572257

2258-
size_t n = mbfl_strwidth(&string);
2259-
ZEND_ASSERT(n != (size_t) -1);
2260-
RETVAL_LONG(n);
2258+
RETVAL_LONG(mbfl_strwidth(&string));
22612259
}
22622260
/* }}} */
22632261

0 commit comments

Comments
 (0)