From cf2626f10c92709f8db44afa15fc09ec6a9d8b0c Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Fri, 8 Nov 2013 15:32:28 +0800 Subject: Fixed bug #65947 (basename is no more working after fgetcsv in certain situation) previous codes: "#define php_mblen(ptr, len) ((ptr) == NULL ? mbsinit(&BG(mblen_state)): (int)mbrlen(ptr, len, &BG(mblen_state)))# it use mbsinit there, seems try to initialize the mblen_state, but: "This function does not change the state identified by ps. Typical ways to make the state pointed by ps an initial state are: memset (ps,0,sizeof(*ps)); // ps points to zero-valued object " http://www.cplusplus.com/reference/cwchar/mbsinit/?kw=mbsinit --- ext/standard/php_string.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ext/standard/php_string.h') diff --git a/ext/standard/php_string.h b/ext/standard/php_string.h index 65219f257a..1ce98ee07a 100644 --- a/ext/standard/php_string.h +++ b/ext/standard/php_string.h @@ -156,7 +156,7 @@ PHPAPI char *php_strerror(int errnum); # define php_mblen(ptr, len) 1 #else # if defined(_REENTRANT) && defined(HAVE_MBRLEN) && defined(HAVE_MBSTATE_T) -# define php_mblen(ptr, len) ((ptr) == NULL ? mbsinit(&BG(mblen_state)): (int)mbrlen(ptr, len, &BG(mblen_state))) +# define php_mblen(ptr, len) ((ptr) == NULL ? memset(&BG(mblen_state), 0, sizeof(BG(mblen_state))): (int)mbrlen(ptr, len, &BG(mblen_state))) # else # define php_mblen(ptr, len) mblen(ptr, len) # endif -- cgit v1.2.1