From: Ilia Alshanetsky Date: Wed, 8 Jun 2005 23:49:38 +0000 (+0000) Subject: Fixed bug #33268 (iconv_strlen() works only with a parameter of < 3 in length) X-Git-Tag: php-5.0.1b1~33 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0c6368d44b594617757aac5b04154d0f427d6361;p=php Fixed bug #33268 (iconv_strlen() works only with a parameter of < 3 in length) --- diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c index b8c76c5bed..7020ff00ef 100644 --- a/ext/iconv/iconv.c +++ b/ext/iconv/iconv.c @@ -516,7 +516,7 @@ static php_iconv_err_t _php_iconv_strlen(unsigned int *pretval, const char *str, #endif } - out_left = 0; + errno = out_left = 0; for (in_p = str, in_left = nbytes, cnt = 0; in_left > 0; cnt+=2) { size_t prev_in_left; @@ -547,6 +547,7 @@ static php_iconv_err_t _php_iconv_strlen(unsigned int *pretval, const char *str, break; case E2BIG: + case 0: *pretval = cnt; break;