Skip to content

Commit bf78070

Browse files
committed
Don't check for impossible error condition in mb_strlen
1 parent d3f56e5 commit bf78070

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

ext/mbstring/libmbfl/mbfl/mbfilter.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -461,9 +461,7 @@ mbfl_strlen(const mbfl_string *string)
461461
string->encoding,
462462
&mbfl_encoding_wchar,
463463
filter_count_output, 0, &len);
464-
if (filter == NULL) {
465-
return (size_t) -1;
466-
}
464+
ZEND_ASSERT(filter);
467465
/* count */
468466
n = string->len;
469467
p = string->val;

ext/mbstring/mbstring.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1823,11 +1823,7 @@ PHP_FUNCTION(mb_strlen)
18231823
RETURN_THROWS();
18241824
}
18251825

1826-
size_t n = mbfl_strlen(&string);
1827-
/* Only way this can fail is if the conversion creation fails
1828-
* this would imply some sort of memory allocation failure which is a bug */
1829-
ZEND_ASSERT(!mbfl_is_error(n));
1830-
RETVAL_LONG(n);
1826+
RETVAL_LONG(mbfl_strlen(&string));
18311827
}
18321828
/* }}} */
18331829

0 commit comments

Comments
 (0)