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

Date: Friday June 25, 1999 @ 18:08
Author: andrey

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

Modified Files:
        pcre.c
Log Message:
Bringing preg_split() behavior in line with split().

Index: php3/functions/pcre.c
diff -u php3/functions/pcre.c:1.10 php3/functions/pcre.c:1.11
--- php3/functions/pcre.c:1.10 Wed Jun 9 17:22:10 1999
+++ php3/functions/pcre.c Fri Jun 25 18:08:14 1999
@@ -27,7 +27,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: pcre.c,v 1.10 1999/06/09 21:22:10 andrey Exp $ */
+/* $Id: pcre.c,v 1.11 1999/06/25 22:08:14 andrey Exp $ */
 
 #include "php.h"
 
@@ -755,7 +755,7 @@
         match = NULL;
         
         /* Get next piece if no limit or limit not yet reached and something matched*/
- while ((limit_val == -1 || limit_val > 0) && count >= 0) {
+ while ((limit_val == -1 || limit_val > 1) && count >= 0) {
                 count = pcre_exec(re, extra, piece,
                                                   subject_end-piece, subject->value.str.val,
                                                   (piece==subject->value.str.val ? exoptions : exoptions|PCRE_NOTBOL),
@@ -783,16 +783,12 @@
                         if (limit_val != -1)
                                 limit_val--;
                 }
- else { /* if no match */
- /* Add the last piece to the return value, if there is
- something left */
- if (limit_val != 0)
- add_next_index_stringl(return_value,
- piece ,
- subject_end-piece, 1);
- }
         }
         
+ /* Add the last piece to the return value */
+ add_next_index_stringl(return_value,
+ piece ,
+ subject_end-piece, 1);
         /* Clean up */
         efree(offsets);
 }

-- 
PHP Development Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>