]> granicus.if.org Git - php/commitdiff
Fixed bug #44075 (strtok misbehaving on unicode string)
authorArnaud Le Blanc <lbarnaud@php.net>
Mon, 24 Nov 2008 19:21:20 +0000 (19:21 +0000)
committerArnaud Le Blanc <lbarnaud@php.net>
Mon, 24 Nov 2008 19:21:20 +0000 (19:21 +0000)
ext/standard/string.c

index 693cff0cc67cdfc44760e43b111400fcc344c37f..dc96e993131567493f391fc69433f36ae8563d28 100644 (file)
@@ -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;