[PHP-DEV] CVS update: php3/functions From: andrey (php-dev <email protected>)
Date: 05/26/99

Date: Wednesday May 26, 1999 @ 14:47
Author: andrey

Update of /repository/php3/functions
In directory php:/tmp/cvs-serv8726/functions

Modified Files:
        reg.c
Log Message:
Fixed a couple of split() bugs.

Index: php3/functions/reg.c
diff -u php3/functions/reg.c:1.99 php3/functions/reg.c:1.100
--- php3/functions/reg.c:1.99 Mon Apr 5 17:46:27 1999
+++ php3/functions/reg.c Wed May 26 14:47:26 1999
@@ -28,7 +28,7 @@
    | Jaakko Hyvätti <jaakko <email protected>> |
    +----------------------------------------------------------------------+
  */
-/* $Id: reg.c,v 1.99 1999/04/05 21:46:27 sas Exp $ */
+/* $Id: reg.c,v 1.100 1999/05/26 18:47:26 andrey Exp $ */
 #ifdef THREAD_SAFE
 #include "tls.h"
 #endif
@@ -543,7 +543,7 @@
         }
 
         /* churn through str, generating array entries as we go */
- while ((count == -1 || count > 1) && !(err = regexec(&re, strp, 1, subs, 0))) {
+ while ((count == -1 || count > 0) && !(err = regexec(&re, strp, 1, subs, 0))) {
                 if (subs[0].rm_so == 0 && subs[0].rm_eo) {
                         /* match is at start of string, return empty string */
                         add_next_index_stringl(return_value, empty_string, 0, 1);
@@ -584,9 +584,10 @@
         }
 
         /* otherwise we just have one last element to add to the array */
- size = endp - strp;
-
- add_next_index_stringl(return_value, strp, size, 1);
+ if (count == -1) {
+ size = endp - strp;
+ add_next_index_stringl(return_value, strp, size, 1);
+ }
 
         _php3_regfree(&re);
 

--
PHP Development Mailing List   http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe <email protected>
For help: php-dev-help <email protected>