From: Arnaud Le Blanc Date: Mon, 24 Nov 2008 19:21:20 +0000 (+0000) Subject: Fixed bug #44075 (strtok misbehaving on unicode string) X-Git-Tag: BEFORE_HEAD_NS_CHANGES_MERGE~94 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=77fed724617def3c6ed350bd449432e2b67bccb1;p=php Fixed bug #44075 (strtok misbehaving on unicode string) --- diff --git a/ext/standard/string.c b/ext/standard/string.c index 693cff0cc6..dc96e99313 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -1569,8 +1569,11 @@ PHP_FUNCTION(strtok) end = i; if (end - start) { + RETVAL_UNICODEL(u_p + start, end - start, 1); + /* skip matched token */ + U16_FWD_1(u_p, end, rem_len); BG(strtok_last) = u_p + end; - RETURN_UNICODEL(u_p + start, end - start, 1); + return; } else { BG(strtok_last) = NULL; RETURN_FALSE;