]> granicus.if.org Git - php/commitdiff
Fix Bug #18341.
authorAndrei Zmievski <andrei@php.net>
Sun, 14 Jul 2002 22:36:47 +0000 (22:36 +0000)
committerAndrei Zmievski <andrei@php.net>
Sun, 14 Jul 2002 22:36:47 +0000 (22:36 +0000)
@- Fixed cases where preg_split() incorrectly terminated final element if
@  it contained null byte. (Andrei)

ext/pcre/php_pcre.c

index 9045d43bcdf4a7609482d3c416db7702255978ca..0884e6b929b6b50102c14d0f816f6c8e7deedcfe 100644 (file)
@@ -1245,8 +1245,9 @@ PHP_FUNCTION(preg_split)
                        add_offset_pair(return_value, &Z_STRVAL_PP(subject)[start_offset], Z_STRLEN_PP(subject) - start_offset, start_offset);
                } else {
                        /* Add the last piece to the return value */
-                       add_next_index_string(return_value,
-                                                                       &Z_STRVAL_PP(subject)[start_offset], 1);
+                       add_next_index_stringl(return_value,
+                                                                  &Z_STRVAL_PP(subject)[start_offset],
+                                                                  Z_STRLEN_PP(subject) - start_offset, 1);
                }
        }