[PHP-CVS-DAILY] cvs: php-src / ChangeLog

2006-07-16 Thread changelog
changelog   Mon Jul 17 01:30:55 2006 UTC

  Modified files:  
/php-srcChangeLog 
  Log:
  ChangeLog update
  
http://cvs.php.net/viewvc.cgi/php-src/ChangeLog?r1=1.2393r2=1.2394diff_format=u
Index: php-src/ChangeLog
diff -u php-src/ChangeLog:1.2393 php-src/ChangeLog:1.2394
--- php-src/ChangeLog:1.2393Sun Jul 16 01:30:48 2006
+++ php-src/ChangeLog   Mon Jul 17 01:30:54 2006
@@ -1,3 +1,174 @@
+2006-07-16  Marcus Boerger  [EMAIL PROTECTED]
+
+* ext/spl/spl.php:
+  -Typo
+
+* (PHP_5_2)
+  ext/spl/spl.php
+  ext/spl/spl_iterators.c
+  ext/spl/spl_iterators.h
+  ext/spl/internal/filteriterator.inc
+  ext/spl/internal/recursiveregexiterator.inc
+  ext/spl/internal/regexiterator.inc
+  ext/spl/tests/iterator_049.phpt
+  ext/spl/tests/iterator_050.phpt
+  ext/spl/tests/iterator_051.phpt
+  ext/spl/tests/iterator_052.phpt
+  ext/spl/tests/iterator_053.phpt
+  ext/spl/tests/iterator_054.phpt
+  ext/spl/tests/iterator_055.phpt:
+  - MFH:
+. Upgrade RegexIterator capabilities, see docu
+. Update docu
+. Add test (which fails right now: iterator_049.phpt)
+. Add tests for new functionality
+
+* (PHP_5_2)
+  ext/pcre/php_pcre.c
+  ext/pcre/php_pcre.h:
+  - MFH: Little bit refactoring: Two new PHPAPI functions:
+. php_pcre_match
+. php_pcre_split
+
+* ext/pcre/php_pcre.h:
+  - TSRM Fix
+
+* ext/spl/spl_iterators.c
+  ext/spl/spl_iterators.h
+  ext/spl/internal/regexiterator.inc
+  ext/spl/internal/regexiterator.inc
+  ext/spl/tests/iterator_050.phpt
+  ext/spl/tests/iterator_050.phpt
+  ext/spl/tests/iterator_051.phpt
+  ext/spl/tests/iterator_051.phpt
+  ext/spl/tests/iterator_052.phpt
+  ext/spl/tests/iterator_052.phpt
+  ext/spl/tests/iterator_053.phpt
+  ext/spl/tests/iterator_053.phpt
+  ext/spl/tests/iterator_054.phpt
+  ext/spl/tests/iterator_054.phpt
+  ext/spl/tests/iterator_055.phpt
+  ext/spl/tests/iterator_055.phpt:
+  - Upgrade RegexIterator capabilities, see docu
+
+* ext/spl/tests/iterator_049.phpt
+  ext/spl/tests/iterator_049.phpt:
+  
+  - This test fails right now and requires a zend API change to fix
+
+2006-07-16  Nuno Lopes  [EMAIL PROTECTED]
+
+* ext/pcre/tests/grep2.phpt
+  ext/pcre/tests/split.phpt
+  ext/pcre/tests/split2.phpt:
+  MFB
+
+* ext/pcre/tests/grep2.phpt
+  ext/pcre/tests/grep2.phpt
+  ext/pcre/tests/split.phpt
+  ext/pcre/tests/split.phpt
+  ext/pcre/tests/split2.phpt
+  ext/pcre/tests/split2.phpt:
+  
+  file grep2.phpt was initially added on branch PHP_5_2.
+
+2006-07-16  Marcus Boerger  [EMAIL PROTECTED]
+
+* ext/pcre/php_pcre.c
+  ext/pcre/php_pcre.h
+  ext/pcre/pcrelib/.cvsignore:
+  - Little bit refactoring: Two new PHPAPI functions:
+. php_pcre_match
+. php_pcre_split
+
+* ext/spl/spl.php
+  ext/spl/internal/filteriterator.inc
+  ext/spl/internal/recursiveregexiterator.inc
+  ext/spl/internal/recursiveregexiterator.inc
+  ext/spl/internal/recursiveregexiterator.inc
+  ext/spl/internal/regexiterator.inc
+  ext/spl/internal/regexiterator.inc:
+  - Update docu
+
+* ext/spl/tests/iterator_048.phpt:
+  - Correct test name
+
+2006-07-16  Christian Stocker  [EMAIL PROTECTED]
+
+* ext/dom/node.c:
+  MFB
+  improved code (after suggestion by helly)
+
+* (PHP_5_2)
+  ext/dom/node.c:
+  improved code (after suggestion by helly)
+
+2006-07-16  Antony Dovgal  [EMAIL PROTECTED]
+
+* (PHP_5_2)
+  ext/standard/tests/strings/bug24098.phpt:
+  fix test
+
+* ext/standard/tests/strings/bug24098.phpt:
+  3+1 != 3  =)
+
+2006-07-16  Pierre-Alain Joye  [EMAIL PROTECTED]
+
+* ext/standard/string.c:
+  - MFB: PATHINFO_FILENAME constant registration (Sara)
+
+2006-07-16  Antony Dovgal  [EMAIL PROTECTED]
+
+* ext/standard/file.c:
+  all stream functions are actually macros that already have TSRMLS_CC,
+  no need to pass it manually
+
+2006-07-16  Christian Stocker  [EMAIL PROTECTED]
+
+* ext/dom/dom_fe.h
+  ext/dom/node.c:
+  Added DOMNode::getNodePath() for getting an XPath for a node.
+  (MFB)
+
+* (PHP_5_2)
+  NEWS
+  ext/dom/dom_fe.h
+  ext/dom/node.c:
+  Added DOMNode::getNodePath() for getting an XPath for a node.
+
+2006-07-16  Pierre-Alain Joye  [EMAIL PROTECTED]
+
+* (PHP_5_2)
+  ext/gd/libgd/gd_gif_in.c:
+  - #38112, corrupt GIF segfaults, test will follow
+
+2006-07-16  Marcus Boerger  [EMAIL PROTECTED]
+
+* (PHP_4_4)
+  NEWS
+  NEWS
+  ext/standard/math.c
+  ext/standard/math.c
+  ext/standard/tests/strings/bug29538.phpt
+  ext/standard/tests/strings/bug29538.phpt:
+  - MFH Fixed Bug #29538 number_format and problem with 0
+
+* ext/standard/math.c
+  

[PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /ext/standard math.c /ext/standard/tests/strings bug29538.phpt

2006-07-16 Thread Marcus Boerger
helly   Sun Jul 16 10:50:58 2006 UTC

  Added files: (Branch: PHP_5_2)
/php-src/ext/standard/tests/strings bug29538.phpt 

  Modified files:  
/php-src/ext/standard   math.c 
/php-srcNEWS 
  Log:
  - MFH Fixed Bug #29538 number_format and problem with 0
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/math.c?r1=1.131.2.2r2=1.131.2.2.2.1diff_format=u
Index: php-src/ext/standard/math.c
diff -u php-src/ext/standard/math.c:1.131.2.2 
php-src/ext/standard/math.c:1.131.2.2.2.1
--- php-src/ext/standard/math.c:1.131.2.2   Mon Feb  6 11:28:41 2006
+++ php-src/ext/standard/math.c Sun Jul 16 10:50:58 2006
@@ -19,7 +19,7 @@
+--+
 */
 
-/* $Id: math.c,v 1.131.2.2 2006/02/06 11:28:41 tony2001 Exp $ */
+/* $Id: math.c,v 1.131.2.2.2.1 2006/07/16 10:50:58 helly Exp $ */
 
 #include php.h
 #include php_math.h
@@ -976,13 +976,8 @@
is_negative = 1;
d = -d;
}
-   if (!dec_point  dec  0) {
-   d *= pow(10, dec);
-   dec = 0;
-   } else {
-   dec = MAX(0, dec);
-   }
 
+   dec = MAX(0, dec);
PHP_ROUND_WITH_FUZZ(d, dec);
 
tmplen = spprintf(tmpbuf, 0, %.*f, dec, d);
@@ -991,8 +986,10 @@
return tmpbuf;
}
 
+   /* find decimal point, if expected */
+   dp = dec ? strchr(tmpbuf, '.') : NULL;
+
/* calculate the length of the return buffer */
-   dp = strchr(tmpbuf, '.');
if (dp) {
integral = dp - tmpbuf;
} else {
@@ -1008,7 +1005,11 @@
reslen = integral;

if (dec) {
-   reslen += 1 + dec;
+   reslen += dec;
+
+   if (dec_point) {
+   reslen++;
+   }
}
 
/* add a byte for minus sign */
@@ -1025,29 +1026,29 @@
 * Take care, as the sprintf implementation may return less places than
 * we requested due to internal buffer limitations */
if (dec) {
-   int declen = dp ? strlen(dp+1) : 0;
-   int topad = declen  0 ? dec - declen : 0;
+   int declen = dp ? s - dp : 0;
+   int topad = dec  declen ? dec - declen : 0;
 
/* pad with '0's */
-
while (topad--) {
*t-- = '0';
}

if (dp) {
-   /* now copy the chars after the point */
-   memcpy(t - declen + 1, dp + 1, declen);
-
+   s -= declen + 1; /* +1 to skip the point */
t -= declen;
-   s -= declen;
+
+   /* now copy the chars after the point */
+   memcpy(t + 1, dp + 1, declen);
}
 
/* add decimal point */
-   *t-- = dec_point;
-   s--;
+   if (dec_point) {
+   *t-- = dec_point;
+   }
}
 
-   /* copy the numbers before the decimal place, adding thousand
+   /* copy the numbers before the decimal point, adding thousand
 * separator every three digits */
while(s = tmpbuf) {
*t-- = *s--;
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.124r2=1.2027.2.547.2.125diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.124 php-src/NEWS:1.2027.2.547.2.125
--- php-src/NEWS:1.2027.2.547.2.124 Sun Jul 16 10:37:24 2006
+++ php-src/NEWSSun Jul 16 10:50:58 2006
@@ -192,6 +192,7 @@
   stream context options). (Mike)
 - Fixed bug #34005 (oci_password_change() fails). 
   (pholdaway at technocom-wireless dot com, Tony)
+- Fixed bug #29538 (number_format and problem with 0). (Matthew Wilmas)
 
 04 May 2006, PHP 5.1.4
 - Added capture_peer_cert and capture_peer_cert_chain context options

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/bug29538.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/strings/bug29538.phpt
+++ php-src/ext/standard/tests/strings/bug29538.phpt
--TEST--
Bug #29538 (number_format and problem with 0)
--FILE--
?php
echo number_format(0.25, 2, '', ''), \n;
echo number_format(1234, 2, '', ',');
?
--EXPECT--
025
1,23400

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_4_4) / NEWS /ext/standard math.c /ext/standard/tests/strings bug29538.phpt

2006-07-16 Thread Marcus Boerger
helly   Sun Jul 16 10:53:56 2006 UTC

  Added files: (Branch: PHP_4_4)
/php-src/ext/standard/tests/strings bug29538.phpt 

  Modified files:  
/php-src/ext/standard   math.c 
/php-srcNEWS 
  Log:
  - MFH Fixed Bug #29538 number_format and problem with 0
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/math.c?r1=1.97.2.13.2.3r2=1.97.2.13.2.4diff_format=u
Index: php-src/ext/standard/math.c
diff -u php-src/ext/standard/math.c:1.97.2.13.2.3 
php-src/ext/standard/math.c:1.97.2.13.2.4
--- php-src/ext/standard/math.c:1.97.2.13.2.3   Sun Jan  1 13:46:57 2006
+++ php-src/ext/standard/math.c Sun Jul 16 10:53:55 2006
@@ -19,7 +19,7 @@
+--+
 */
 
-/* $Id: math.c,v 1.97.2.13.2.3 2006/01/01 13:46:57 sniper Exp $ */
+/* $Id: math.c,v 1.97.2.13.2.4 2006/07/16 10:53:55 helly Exp $ */
 
 #include php.h
 #include php_math.h
@@ -1015,13 +1015,8 @@
is_negative = 1;
d = -d;
}
-   if (!dec_point  dec  0) {
-   d *= pow(10, dec);
-   dec = 0;
-   } else {
-   dec = MAX(0, dec);
-   }
 
+   dec = MAX(0, dec);
PHP_ROUND_WITH_FUZZ(d, dec);
 
tmplen = spprintf(tmpbuf, 0, %.*f, dec, d);
@@ -1030,8 +1025,10 @@
return tmpbuf;
}
 
+   /* find decimal point, if expected */
+   dp = dec ? strchr(tmpbuf, '.') : NULL;
+
/* calculate the length of the return buffer */
-   dp = strchr(tmpbuf, '.');
if (dp) {
integral = dp - tmpbuf;
} else {
@@ -1047,7 +1044,11 @@
reslen = integral;
 
if (dec) {
-   reslen += 1 + dec;
+   reslen += dec;
+
+   if (dec_point) {
+   reslen++;
+   }
}
 
/* add a byte for minus sign */
@@ -1064,29 +1065,29 @@
 * Take care, as the sprintf implementation may return less places than
 * we requested due to internal buffer limitations */
if (dec) {
-   int declen = dp ? strlen(dp+1) : 0;
-   int topad = declen  0 ? dec - declen : 0;
+   int declen = dp ? s - dp : 0;
+   int topad = dec  declen ? dec - declen : 0;
 
/* pad with '0's */
-
while (topad--) {
*t-- = '0';
}
 
if (dp) {
-   /* now copy the chars after the point */
-   memcpy(t - declen + 1, dp + 1, declen);
-
+   s -= declen + 1; /* +1 to skip the point */
t -= declen;
-   s -= declen;
+
+   /* now copy the chars after the point */
+   memcpy(t + 1, dp + 1, declen);
}
 
/* add decimal point */
-   *t-- = dec_point;
-   s--;
+   if (dec_point) {
+   *t-- = dec_point;
+   }
}
 
-   /* copy the numbers before the decimal place, adding thousand
+   /* copy the numbers before the decimal point, adding thousand
 * separator every three digits */
while(s = tmpbuf) {
*t-- = *s--;
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.1247.2.920.2.140r2=1.1247.2.920.2.141diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.1247.2.920.2.140 php-src/NEWS:1.1247.2.920.2.141
--- php-src/NEWS:1.1247.2.920.2.140 Tue Jul  4 16:40:23 2006
+++ php-src/NEWSSun Jul 16 10:53:55 2006
@@ -9,6 +9,7 @@
 - Fixed bug #37720 (merge_php_config scrambles values). (Mike,
   pumuckel at metropolis dot de)
 - Fixed bug #37569 (WDDX incorrectly encodes high-ascii characters). (Ilia)
+- Fixed bug #29538 (number_format and problem with 0). (Matthew Wilmas)
 
 21 May 2006, Version 4.4.3RC1
 - Added control character checks for cURL extension's open_basedir/safe_mode

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/bug29538.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/strings/bug29538.phpt
+++ php-src/ext/standard/tests/strings/bug29538.phpt
--TEST--
Bug #29538 (number_format and problem with 0)
--FILE--
?php
echo number_format(0.25, 2, '', ''), \n;
echo number_format(1234, 2, '', ',');
?
--EXPECT--
025
1,23400

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/standard string.c /ext/standard/tests/strings bug24098.phpt

2006-07-16 Thread Marcus Boerger
helly   Sun Jul 16 10:34:32 2006 UTC

  Modified files:  
/php-src/ext/standard   string.c 
/php-src/ext/standard/tests/strings bug24098.phpt 
  Log:
  - Pathinfo allows to get filename (Toby S, Christian S)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.551r2=1.552diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.551 php-src/ext/standard/string.c:1.552
--- php-src/ext/standard/string.c:1.551 Thu Jul 13 22:26:50 2006
+++ php-src/ext/standard/string.c   Sun Jul 16 10:34:31 2006
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.551 2006/07/13 22:26:50 andrei Exp $ */
+/* $Id: string.c,v 1.552 2006/07/16 10:34:31 helly Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -62,7 +62,8 @@
 #define PHP_PATHINFO_DIRNAME   1
 #define PHP_PATHINFO_BASENAME  2
 #define PHP_PATHINFO_EXTENSION 4
-#define PHP_PATHINFO_ALL   (PHP_PATHINFO_DIRNAME | PHP_PATHINFO_BASENAME | 
PHP_PATHINFO_EXTENSION)
+#define PHP_PATHINFO_FILENAME  8
+#define PHP_PATHINFO_ALL   (PHP_PATHINFO_DIRNAME | PHP_PATHINFO_BASENAME | 
PHP_PATHINFO_EXTENSION | PHP_PATHINFO_FILENAME)
 
 #define STR_STRSPN 0
 #define STR_STRCSPN1
@@ -1948,6 +1949,26 @@
efree(ret);
}
}
+   
+   if ((opt  PHP_PATHINFO_FILENAME) == PHP_PATHINFO_FILENAME) {
+   char *p;
+   int idx;
+   int have_basename = ((opt  PHP_PATHINFO_BASENAME) == 
PHP_PATHINFO_BASENAME);
+
+   /* Have we alrady looked up the basename? */
+   if (!have_basename) {
+   php_basename(path, path_len, NULL, 0, ret, ret_len 
TSRMLS_CC);
+   }
+
+   p = strrchr(ret, '.');
+
+   idx = p ? (p - ret) : ret_len;
+   add_assoc_stringl(tmp, filename, ret, idx, 1);
+
+   if (!have_basename) {
+   efree(ret);
+   }
+   }
 
if (opt == PHP_PATHINFO_ALL) {
RETURN_ZVAL(tmp, 0, 1);
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/bug24098.phpt?r1=1.3r2=1.4diff_format=u
Index: php-src/ext/standard/tests/strings/bug24098.phpt
diff -u php-src/ext/standard/tests/strings/bug24098.phpt:1.3 
php-src/ext/standard/tests/strings/bug24098.phpt:1.4
--- php-src/ext/standard/tests/strings/bug24098.phpt:1.3Tue Aug 23 
12:53:30 2005
+++ php-src/ext/standard/tests/strings/bug24098.phptSun Jul 16 10:34:32 2006
@@ -14,6 +14,8 @@
   string(8) dsds.asa
   [extension]=
   string(3) asa
+  [filename]=
+  string(4) dsds
 }
 --UEXPECT--
 array(3) {
@@ -23,4 +25,6 @@
   unicode(8) dsds.asa
   [uextension]=
   unicode(3) asa
+  [ufilename]=
+  string(4) dsds
 }

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/gd/libgd gd_gif_in.c

2006-07-16 Thread Pierre-Alain Joye
pajoye  Sun Jul 16 11:07:31 2006 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/gd/libgd   gd_gif_in.c 
  Log:
  - #38112, corrupt GIF segfaults, test will follow
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd_gif_in.c?r1=1.5.4.2.2.4r2=1.5.4.2.2.5diff_format=u
Index: php-src/ext/gd/libgd/gd_gif_in.c
diff -u php-src/ext/gd/libgd/gd_gif_in.c:1.5.4.2.2.4 
php-src/ext/gd/libgd/gd_gif_in.c:1.5.4.2.2.5
--- php-src/ext/gd/libgd/gd_gif_in.c:1.5.4.2.2.4Mon May  8 12:06:59 2006
+++ php-src/ext/gd/libgd/gd_gif_in.cSun Jul 16 11:07:31 2006
@@ -206,6 +206,7 @@
BitSet(buf[8], INTERLACE));
/*1.4//imageCount != imageNumber); */
}
+
if (Transparent != (-1)) {
gdImageColorTransparent(im, Transparent);
}
@@ -217,6 +218,12 @@
if (!im) {
return 0;
}
+
+   if (!im-colorsTotal) {
+   gdImageDestroy(im);
+   return 0;
+   }
+
/* Check for open colors at the end, so
   we can reduce colorsTotal and ultimately
   BitsPerPixel */
@@ -506,6 +513,19 @@
int v;
int xpos = 0, ypos = 0, pass = 0;
int i;
+
+
+   /*
+**  Initialize the Compression routines
+*/
+   if (! ReadOK(fd,c,1)) {
+   return;
+   }
+
+   if (c  8) {
+   return; 
+   }
+
/* Stash the color map into the image */
for (i=0; (igdMaxColors); i++) {
im-red[i] = cmap[CM_RED][i];
@@ -515,12 +535,6 @@
}
/* Many (perhaps most) of these colors will remain marked open. */
im-colorsTotal = gdMaxColors;
-   /*
-**  Initialize the Compression routines
-*/
-   if (! ReadOK(fd,c,1)) {
-   return;
-   }
if (LWZReadByte(fd, TRUE, c)  0) {
return;
}

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/standard math.c /ext/standard/tests/strings bug29538.phpt

2006-07-16 Thread Marcus Boerger
helly   Sun Jul 16 10:49:06 2006 UTC

  Added files: 
/php-src/ext/standard/tests/strings bug29538.phpt 

  Modified files:  
/php-src/ext/standard   math.c 
  Log:
  - Fixed Bug #29538 number_format and problem with 0
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/math.c?r1=1.134r2=1.135diff_format=u
Index: php-src/ext/standard/math.c
diff -u php-src/ext/standard/math.c:1.134 php-src/ext/standard/math.c:1.135
--- php-src/ext/standard/math.c:1.134   Mon Feb  6 11:28:20 2006
+++ php-src/ext/standard/math.c Sun Jul 16 10:49:06 2006
@@ -19,7 +19,7 @@
+--+
 */
 
-/* $Id: math.c,v 1.134 2006/02/06 11:28:20 tony2001 Exp $ */
+/* $Id: math.c,v 1.135 2006/07/16 10:49:06 helly Exp $ */
 
 #include php.h
 #include php_math.h
@@ -976,13 +976,8 @@
is_negative = 1;
d = -d;
}
-   if (!dec_point  dec  0) {
-   d *= pow(10, dec);
-   dec = 0;
-   } else {
-   dec = MAX(0, dec);
-   }
 
+   dec = MAX(0, dec);
PHP_ROUND_WITH_FUZZ(d, dec);
 
tmplen = spprintf(tmpbuf, 0, %.*f, dec, d);
@@ -991,8 +986,10 @@
return tmpbuf;
}
 
+   /* find decimal point, if expected */
+   dp = dec ? strchr(tmpbuf, '.') : NULL;
+
/* calculate the length of the return buffer */
-   dp = strchr(tmpbuf, '.');
if (dp) {
integral = dp - tmpbuf;
} else {
@@ -1008,7 +1005,11 @@
reslen = integral;

if (dec) {
-   reslen += 1 + dec;
+   reslen += dec;
+
+   if (dec_point) {
+   reslen++;
+   }
}
 
/* add a byte for minus sign */
@@ -1025,29 +1026,29 @@
 * Take care, as the sprintf implementation may return less places than
 * we requested due to internal buffer limitations */
if (dec) {
-   int declen = dp ? strlen(dp+1) : 0;
-   int topad = declen  0 ? dec - declen : 0;
+   int declen = dp ? s - dp : 0;
+   int topad = dec  declen ? dec - declen : 0;
 
/* pad with '0's */
-
while (topad--) {
*t-- = '0';
}

if (dp) {
-   /* now copy the chars after the point */
-   memcpy(t - declen + 1, dp + 1, declen);
-
+   s -= declen + 1; /* +1 to skip the point */
t -= declen;
-   s -= declen;
+
+   /* now copy the chars after the point */
+   memcpy(t + 1, dp + 1, declen);
}
 
/* add decimal point */
-   *t-- = dec_point;
-   s--;
+   if (dec_point) {
+   *t-- = dec_point;
+   }
}
 
-   /* copy the numbers before the decimal place, adding thousand
+   /* copy the numbers before the decimal point, adding thousand
 * separator every three digits */
while(s = tmpbuf) {
*t-- = *s--;

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/bug29538.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/strings/bug29538.phpt
+++ php-src/ext/standard/tests/strings/bug29538.phpt
--TEST--
Bug #29538 (number_format and problem with 0)
--FILE--
?php
echo number_format(0.25, 2, '', ''), \n;
echo number_format(1234, 2, '', ',');
?
--EXPECT--
025
1,23400

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /ext/dom dom_fe.h node.c

2006-07-16 Thread Christian Stocker
chregu  Sun Jul 16 15:03:53 2006 UTC

  Modified files:  (Branch: PHP_5_2)
/php-srcNEWS 
/php-src/ext/domdom_fe.h node.c 
  Log:
  Added DOMNode::getNodePath() for getting an XPath for a node.
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.125r2=1.2027.2.547.2.126diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.125 php-src/NEWS:1.2027.2.547.2.126
--- php-src/NEWS:1.2027.2.547.2.125 Sun Jul 16 10:50:58 2006
+++ php-src/NEWSSun Jul 16 15:03:53 2006
@@ -77,6 +77,7 @@
 - Added pg_field_table() function. (Edin)
 - Added SimpleXMLElement::saveXML() as an alias for SimpleXMLElement::asXML().
   (Hannes)
+- Added DOMNode::getNodePath() for getting an XPath for a node. (Christian)
 
 - Optimized zend_try/zend_catch macros by eliminating memcpy(3). (Dmitry)
 - Optimized require_once() and include_once() by eliminating fopen(3)
http://cvs.php.net/viewvc.cgi/php-src/ext/dom/dom_fe.h?r1=1.14.2.1.2.2r2=1.14.2.1.2.3diff_format=u
Index: php-src/ext/dom/dom_fe.h
diff -u php-src/ext/dom/dom_fe.h:1.14.2.1.2.2 
php-src/ext/dom/dom_fe.h:1.14.2.1.2.3
--- php-src/ext/dom/dom_fe.h:1.14.2.1.2.2   Fri May 26 18:23:50 2006
+++ php-src/ext/dom/dom_fe.hSun Jul 16 15:03:53 2006
@@ -17,7 +17,7 @@
+--+
 */
 
-/* $Id: dom_fe.h,v 1.14.2.1.2.2 2006/05/26 18:23:50 rrichards Exp $ */
+/* $Id: dom_fe.h,v 1.14.2.1.2.3 2006/07/16 15:03:53 chregu Exp $ */
 #ifndef DOM_FE_H
 #define DOM_FE_H
 
@@ -167,6 +167,7 @@
 PHP_FUNCTION(dom_node_get_user_data);
 PHP_METHOD(domnode, C14N);
 PHP_METHOD(domnode, C14NFile);
+PHP_METHOD(domnode, getNodePath);
 
 /* domnodelist methods */
 PHP_FUNCTION(dom_nodelist_item);
http://cvs.php.net/viewvc.cgi/php-src/ext/dom/node.c?r1=1.37.2.3.2.1r2=1.37.2.3.2.2diff_format=u
Index: php-src/ext/dom/node.c
diff -u php-src/ext/dom/node.c:1.37.2.3.2.1 php-src/ext/dom/node.c:1.37.2.3.2.2
--- php-src/ext/dom/node.c:1.37.2.3.2.1 Fri May 26 18:23:50 2006
+++ php-src/ext/dom/node.c  Sun Jul 16 15:03:53 2006
@@ -17,7 +17,7 @@
+--+
 */
 
-/* $Id: node.c,v 1.37.2.3.2.1 2006/05/26 18:23:50 rrichards Exp $ */
+/* $Id: node.c,v 1.37.2.3.2.2 2006/07/16 15:03:53 chregu Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -53,6 +53,7 @@
PHP_FALIAS(getFeature, dom_node_get_feature, NULL)
PHP_FALIAS(setUserData, dom_node_set_user_data, NULL)
PHP_FALIAS(getUserData, dom_node_get_user_data, NULL)
+   PHP_ME(domnode, getNodePath, NULL, ZEND_ACC_PUBLIC)
PHP_ME(domnode, C14N, NULL, ZEND_ACC_PUBLIC)
PHP_ME(domnode, C14NFile, NULL, ZEND_ACC_PUBLIC)
{NULL, NULL, NULL}
@@ -1857,3 +1858,32 @@
 }
 
 #endif
+
+/* {{{ proto int DOMNode::getNodePath()
+   Gets an xpath for a node */
+
+PHP_METHOD(domnode, getNodePath)
+{
+   zval *id;
+   xmlNode *nodep;
+   dom_object *intern;
+   char *value;
+   
+
+   if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
O, id, dom_node_class_entry) == FAILURE) {
+   return;
+   }
+
+   DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
+
+   value = xmlGetNodePath(nodep);
+   if (value == NULL) {
+   RETURN_EMPTY_STRING();
+   } else {
+   RETVAL_STRING(value, 1);
+   xmlFree(value);
+   }
+
+   
+}
+

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/dom dom_fe.h node.c

2006-07-16 Thread Christian Stocker
chregu  Sun Jul 16 15:05:32 2006 UTC

  Modified files:  
/php-src/ext/domdom_fe.h node.c 
  Log:
  Added DOMNode::getNodePath() for getting an XPath for a node.
  (MFB)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/dom/dom_fe.h?r1=1.17r2=1.18diff_format=u
Index: php-src/ext/dom/dom_fe.h
diff -u php-src/ext/dom/dom_fe.h:1.17 php-src/ext/dom/dom_fe.h:1.18
--- php-src/ext/dom/dom_fe.h:1.17   Fri May 26 18:22:06 2006
+++ php-src/ext/dom/dom_fe.hSun Jul 16 15:05:32 2006
@@ -17,7 +17,7 @@
+--+
 */
 
-/* $Id: dom_fe.h,v 1.17 2006/05/26 18:22:06 rrichards Exp $ */
+/* $Id: dom_fe.h,v 1.18 2006/07/16 15:05:32 chregu Exp $ */
 #ifndef DOM_FE_H
 #define DOM_FE_H
 
@@ -167,6 +167,7 @@
 PHP_FUNCTION(dom_node_get_user_data);
 PHP_METHOD(domnode, C14N);
 PHP_METHOD(domnode, C14NFile);
+PHP_METHOD(domnode, getNodePath);
 
 /* domnodelist methods */
 PHP_FUNCTION(dom_nodelist_item);
http://cvs.php.net/viewvc.cgi/php-src/ext/dom/node.c?r1=1.44r2=1.45diff_format=u
Index: php-src/ext/dom/node.c
diff -u php-src/ext/dom/node.c:1.44 php-src/ext/dom/node.c:1.45
--- php-src/ext/dom/node.c:1.44 Fri May 26 18:22:06 2006
+++ php-src/ext/dom/node.c  Sun Jul 16 15:05:32 2006
@@ -17,7 +17,7 @@
+--+
 */
 
-/* $Id: node.c,v 1.44 2006/05/26 18:22:06 rrichards Exp $ */
+/* $Id: node.c,v 1.45 2006/07/16 15:05:32 chregu Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -53,6 +53,7 @@
PHP_FALIAS(getFeature, dom_node_get_feature, NULL)
PHP_FALIAS(setUserData, dom_node_set_user_data, NULL)
PHP_FALIAS(getUserData, dom_node_get_user_data, NULL)
+   PHP_ME(domnode, getNodePath, NULL, ZEND_ACC_PUBLIC)
PHP_ME(domnode, C14N, NULL, ZEND_ACC_PUBLIC)
PHP_ME(domnode, C14NFile, NULL, ZEND_ACC_PUBLIC)
{NULL, NULL, NULL}
@@ -1857,3 +1858,32 @@
 }
 
 #endif
+
+/* {{{ proto int DOMNode::getNodePath()
+   Gets an xpath for a node */
+
+PHP_METHOD(domnode, getNodePath)
+{
+   zval *id;
+   xmlNode *nodep;
+   dom_object *intern;
+   char *value;
+   
+
+   if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
O, id, dom_node_class_entry) == FAILURE) {
+   return;
+   }
+
+   DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
+
+   value = xmlGetNodePath(nodep);
+   if (value == NULL) {
+   RETURN_EMPTY_STRING();
+   } else {
+   RETVAL_STRING(value, 1);
+   xmlFree(value);
+   }
+
+   
+}
+

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/standard string.c

2006-07-16 Thread Pierre-Alain Joye
pajoye  Sun Jul 16 15:56:00 2006 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  - MFB: PATHINFO_FILENAME constant registration (Sara)
  http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.552r2=1.553diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.552 php-src/ext/standard/string.c:1.553
--- php-src/ext/standard/string.c:1.552 Sun Jul 16 10:34:31 2006
+++ php-src/ext/standard/string.c   Sun Jul 16 15:56:00 2006
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.552 2006/07/16 10:34:31 helly Exp $ */
+/* $Id: string.c,v 1.553 2006/07/16 15:56:00 pajoye Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -78,9 +78,10 @@
REGISTER_LONG_CONSTANT(PATHINFO_DIRNAME, PHP_PATHINFO_DIRNAME, 
CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(PATHINFO_BASENAME, PHP_PATHINFO_BASENAME, 
CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(PATHINFO_EXTENSION, PHP_PATHINFO_EXTENSION, 
CONST_CS | CONST_PERSISTENT);
+   REGISTER_LONG_CONSTANT(PATHINFO_FILENAME, PHP_PATHINFO_FILENAME, 
CONST_CS | CONST_PERSISTENT);
 
 #ifdef HAVE_LOCALECONV
-   /* If last members of struct lconv equal CHAR_MAX, no grouping is done 
*/   
+   /* If last members of struct lconv equal CHAR_MAX, no grouping is done 
*/
 
 /* This is bad, but since we are going to be hardcoding in the POSIX stuff 
anyway... */
 # ifndef HAVE_LIMITS_H
@@ -101,7 +102,7 @@
REGISTER_LONG_CONSTANT(LC_MESSAGES, LC_MESSAGES, CONST_CS | 
CONST_PERSISTENT);
 # endif
 #endif
-   
+
 }
 /* }}} */
 
@@ -125,14 +126,14 @@
size_t i, j;
 
result = (unsigned char *) safe_emalloc(oldlen * 2, sizeof(char), 1);
-   
+
for (i = j = 0; i  oldlen; i++) {
result[j++] = hexconvtab[old[i]  4];
result[j++] = hexconvtab[old[i]  15];
}
result[j] = '\0';
 
-   if (newlen) 
+   if (newlen)
*newlen = oldlen * 2 * sizeof(char);
 
return (char*)result;
@@ -199,7 +200,7 @@
}
 
result = php_bin2hex(data, data_len, newlen);
-   
+
if (!result) {
RETURN_FALSE;
}
@@ -217,7 +218,7 @@
int len1, len2;
zend_uchar type1, type2;
long start, len; /* For UNICODE, these are codepoint units */
-   
+
start = 0;
len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, TT|ll,
@@ -225,13 +226,13 @@
  start, len) == 
FAILURE) {
return;
}
-   
+
if (ZEND_NUM_ARGS()  4) {
len = len1;
}
-   
+
/* look at substr() function for more information */
-   
+
if (start  0) {
start += len1;
if (start  0) {
@@ -240,14 +241,14 @@
} else if (start  len1) {
RETURN_FALSE;
}
-   
+
if (len  0) {
len += (len1 - start);
if (len  0) {
len = 0;
}
}
-   
+
if (((unsigned) start + (unsigned) len)  len1) {
len = len1 - start;
}
@@ -480,7 +481,7 @@
 {
zval **item;
char *value;
-   
+
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, item) == 
FAILURE) {
WRONG_PARAM_COUNT;
}
@@ -509,7 +510,7 @@
convert_to_string_ex(s1);
convert_to_string_ex(s2);
 
-   RETURN_LONG(strcoll((const char *) Z_STRVAL_PP(s1), 
+   RETURN_LONG(strcoll((const char *) Z_STRVAL_PP(s1),
(const char *) Z_STRVAL_PP(s2)));
 }
 /* }}} */
@@ -517,7 +518,7 @@
 
 /* {{{ php_charmask
  * Fills a 256-byte bytemask with input. You can specify a range like 'a..z',
- * it needs to be incrementing.  
+ * it needs to be incrementing.
  * Returns: FAILURE/SUCCESS whether the input was correct (i.e. no range 
errors)
  */
 static inline int php_charmask(unsigned char *input, int len, char *mask 
TSRMLS_DC)
@@ -528,8 +529,8 @@
 
memset(mask, 0, 256);
for (end = input+len; input  end; input++) {
-   c=*input; 
-   if ((input+3  end)  input[1] == '.'  input[2] == '.' 
+   c=*input;
+   if ((input+3  end)  input[1] == '.'  input[2] == '.'
 input[3] = c) {
memset(mask+c, 1, input[3] - c + 1);
input+=3;
@@ -550,7 +551,7 @@
php_error_docref(NULL TSRMLS_CC, E_WARNING, 
Invalid '..'-range, '..'-range needs to be incrementing.);
result = FAILURE;
continue;
-   } 
+   }
/* FIXME: better error 

[PHP-CVS] cvs: php-src /ext/standard/tests/strings bug24098.phpt

2006-07-16 Thread Antony Dovgal
tony2001Sun Jul 16 15:59:02 2006 UTC

  Modified files:  
/php-src/ext/standard/tests/strings bug24098.phpt 
  Log:
  3+1 != 3  =)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/bug24098.phpt?r1=1.4r2=1.5diff_format=u
Index: php-src/ext/standard/tests/strings/bug24098.phpt
diff -u php-src/ext/standard/tests/strings/bug24098.phpt:1.4 
php-src/ext/standard/tests/strings/bug24098.phpt:1.5
--- php-src/ext/standard/tests/strings/bug24098.phpt:1.4Sun Jul 16 
10:34:32 2006
+++ php-src/ext/standard/tests/strings/bug24098.phptSun Jul 16 15:59:02 2006
@@ -7,7 +7,7 @@
var_dump(pathinfo(/dsds.asa));
 ?
 --EXPECT--
-array(3) {
+array(4) {
   [dirname]=
   string(1) /
   [basename]=
@@ -18,7 +18,7 @@
   string(4) dsds
 }
 --UEXPECT--
-array(3) {
+array(4) {
   [udirname]=
   unicode(1) /
   [ubasename]=

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard/tests/strings bug24098.phpt

2006-07-16 Thread Antony Dovgal
tony2001Sun Jul 16 15:59:08 2006 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/standard/tests/strings bug24098.phpt 
  Log:
  fix test
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/bug24098.phpt?r1=1.2.6.1r2=1.2.6.2diff_format=u
Index: php-src/ext/standard/tests/strings/bug24098.phpt
diff -u php-src/ext/standard/tests/strings/bug24098.phpt:1.2.6.1 
php-src/ext/standard/tests/strings/bug24098.phpt:1.2.6.2
--- php-src/ext/standard/tests/strings/bug24098.phpt:1.2.6.1Sun Jul 16 
10:37:24 2006
+++ php-src/ext/standard/tests/strings/bug24098.phptSun Jul 16 15:59:08 2006
@@ -7,7 +7,7 @@
var_dump(pathinfo(/dsds.asa));
 ?
 --EXPECT--
-array(3) {
+array(4) {
   [dirname]=
   string(1) /
   [basename]=

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/standard file.c

2006-07-16 Thread Antony Dovgal
tony2001Sun Jul 16 15:54:25 2006 UTC

  Modified files:  
/php-src/ext/standard   file.c 
  Log:
  all stream functions are actually macros that already have TSRMLS_CC,
  no need to pass it manually
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.448r2=1.449diff_format=u
Index: php-src/ext/standard/file.c
diff -u php-src/ext/standard/file.c:1.448 php-src/ext/standard/file.c:1.449
--- php-src/ext/standard/file.c:1.448   Sat Jul 15 14:31:51 2006
+++ php-src/ext/standard/file.c Sun Jul 16 15:54:25 2006
@@ -21,7 +21,7 @@
+--+
  */
 
-/* $Id: file.c,v 1.448 2006/07/15 14:31:51 helly Exp $ */
+/* $Id: file.c,v 1.449 2006/07/16 15:54:25 tony2001 Exp $ */
 
 /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
 
@@ -2422,7 +2422,7 @@
UChar *path;
int path_len;
 
-   if (php_stream_path_decode(php_plain_files_wrapper, 
path, path_len, filename, filename_len, REPORT_ERRORS, FG(default_context) 
TSRMLS_CC) == SUCCESS) {
+   if (php_stream_path_decode(php_plain_files_wrapper, 
path, path_len, filename, filename_len, REPORT_ERRORS, FG(default_context)) 
== SUCCESS) {
RETVAL_UNICODEL(path, path_len, 0);
} else {
RETVAL_FALSE;

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/dom node.c

2006-07-16 Thread Christian Stocker
chregu  Sun Jul 16 16:04:09 2006 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/domnode.c 
  Log:
  improved code (after suggestion by helly)
  
  
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/dom/node.c?r1=1.37.2.3.2.2r2=1.37.2.3.2.3diff_format=u
Index: php-src/ext/dom/node.c
diff -u php-src/ext/dom/node.c:1.37.2.3.2.2 php-src/ext/dom/node.c:1.37.2.3.2.3
--- php-src/ext/dom/node.c:1.37.2.3.2.2 Sun Jul 16 15:03:53 2006
+++ php-src/ext/dom/node.c  Sun Jul 16 16:04:09 2006
@@ -17,7 +17,7 @@
+--+
 */
 
-/* $Id: node.c,v 1.37.2.3.2.2 2006/07/16 15:03:53 chregu Exp $ */
+/* $Id: node.c,v 1.37.2.3.2.3 2006/07/16 16:04:09 chregu Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -1870,15 +1870,12 @@
char *value;

 
-   if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
O, id, dom_node_class_entry) == FAILURE) {
-   return;
-   }
-
-   DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
+   
+   DOM_GET_THIS_OBJ(nodep, id, xmlNodePtr, intern);
 
value = xmlGetNodePath(nodep);
if (value == NULL) {
-   RETURN_EMPTY_STRING();
+   RETURN_NULL();
} else {
RETVAL_STRING(value, 1);
xmlFree(value);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/dom node.c

2006-07-16 Thread Christian Stocker
chregu  Sun Jul 16 16:04:36 2006 UTC

  Modified files:  
/php-src/ext/domnode.c 
  Log:
  MFB
  improved code (after suggestion by helly)
  
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/dom/node.c?r1=1.45r2=1.46diff_format=u
Index: php-src/ext/dom/node.c
diff -u php-src/ext/dom/node.c:1.45 php-src/ext/dom/node.c:1.46
--- php-src/ext/dom/node.c:1.45 Sun Jul 16 15:05:32 2006
+++ php-src/ext/dom/node.c  Sun Jul 16 16:04:35 2006
@@ -17,7 +17,7 @@
+--+
 */
 
-/* $Id: node.c,v 1.45 2006/07/16 15:05:32 chregu Exp $ */
+/* $Id: node.c,v 1.46 2006/07/16 16:04:35 chregu Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -1870,15 +1870,12 @@
char *value;

 
-   if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
O, id, dom_node_class_entry) == FAILURE) {
-   return;
-   }
-
-   DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
+   
+   DOM_GET_THIS_OBJ(nodep, id, xmlNodePtr, intern);
 
value = xmlGetNodePath(nodep);
if (value == NULL) {
-   RETURN_EMPTY_STRING();
+   RETURN_NULL();
} else {
RETVAL_STRING(value, 1);
xmlFree(value);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/spl/tests iterator_048.phpt

2006-07-16 Thread Marcus Boerger
helly   Sun Jul 16 17:33:46 2006 UTC

  Modified files:  
/php-src/ext/spl/tests  iterator_048.phpt 
  Log:
  - Correct test name
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/iterator_048.phpt?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/spl/tests/iterator_048.phpt
diff -u php-src/ext/spl/tests/iterator_048.phpt:1.1 
php-src/ext/spl/tests/iterator_048.phpt:1.2
--- php-src/ext/spl/tests/iterator_048.phpt:1.1 Sun May 21 17:27:12 2006
+++ php-src/ext/spl/tests/iterator_048.phpt Sun Jul 16 17:33:46 2006
@@ -1,5 +1,5 @@
 --TEST--
-SPL: RecursiveCachingIterator and exception in has/getChildren
+SPL: RecursiveRegexIterator and exception in has/getChildren
 --SKIPIF--
 ?php if (!extension_loaded(spl)) print skip; ?
 --FILE--

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/spl/tests iterator_048.phpt

2006-07-16 Thread Marcus Boerger
helly   Sun Jul 16 17:34:37 2006 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/spl/tests  iterator_048.phpt 
  Log:
  - MFH Correct test name
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/iterator_048.phpt?r1=1.1.2.3r2=1.1.2.4diff_format=u
Index: php-src/ext/spl/tests/iterator_048.phpt
diff -u php-src/ext/spl/tests/iterator_048.phpt:1.1.2.3 
php-src/ext/spl/tests/iterator_048.phpt:1.1.2.4
--- php-src/ext/spl/tests/iterator_048.phpt:1.1.2.3 Tue Jul 11 12:15:10 2006
+++ php-src/ext/spl/tests/iterator_048.phpt Sun Jul 16 17:34:37 2006
@@ -1,5 +1,5 @@
 --TEST--
-SPL: RecursiveCachingIterator and exception in has/getChildren
+SPL: RecursiveRegexIterator and exception in has/getChildren
 --SKIPIF--
 ?php if (!extension_loaded(spl)) print skip; ?
 --FILE--

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/spl/internal filteriterator.inc regexiterator.inc

2006-07-16 Thread Marcus Boerger
helly   Sun Jul 16 19:16:04 2006 UTC

  Added files: 
/php-src/ext/spl/internal   regexiterator.inc 

  Modified files:  
/php-src/ext/spl/internal   filteriterator.inc 
  Log:
  - Update docu
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/internal/filteriterator.inc?r1=1.9r2=1.10diff_format=u
Index: php-src/ext/spl/internal/filteriterator.inc
diff -u php-src/ext/spl/internal/filteriterator.inc:1.9 
php-src/ext/spl/internal/filteriterator.inc:1.10
--- php-src/ext/spl/internal/filteriterator.inc:1.9 Tue Feb 21 23:21:53 2006
+++ php-src/ext/spl/internal/filteriterator.inc Sun Jul 16 19:16:03 2006
@@ -10,7 +10,7 @@
  */
 
 /**
- * @brief   Regular expression filter for string iterators
+ * @brief   Abstract filter for iterators
  * @author  Marcus Boerger
  * @version 1.1
  * @since PHP 5.0
@@ -28,11 +28,9 @@
private $it;
 
/**
-* Constructs a filter around an iterator whose elemnts are strings.
-* If the given iterator is of type spl_sequence then its rewind()
-* method is called.
+* Constructs a filter around another iterator.
 *
-* @param it Object that implements at least spl_forward
+* @param it Iterator to filter
 */
function __construct(Iterator $it) {
$this-it = $it;

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/internal/regexiterator.inc?view=markuprev=1.1
Index: php-src/ext/spl/internal/regexiterator.inc
+++ php-src/ext/spl/internal/regexiterator.inc
?php

/** @file regexiterator.inc
 * @ingroup SPL
 * @brief class RegexIterator
 * @author  Marcus Boerger
 * @date2003 - 2006
 *
 * SPL - Standard PHP Library
 */

/**
 * @brief   Regular expression filter for iterators
 * @author  Marcus Boerger
 * @version 1.0
 * @since PHP 5.1
 *
 * This filter iterator assumes that the inner iterator 
 */
class RegexIterator implements FilterIterator
{
const USE_KEY = 0x0001;

private $regex; /** the regular expression to match against */
private $flags; /** special flags (USE_KEY) */

/**
 * Constructs a regular expression filter around an iterator whose 
 * elemnts or keys are strings.
 *
 * @param it Object that implements at least
 */
function __construct(Iterator $it, $regex, $flags = 0) {
parent::__construct($it);
$this-regex = $regex;
$this-flags = $flags;
}

/**
 * Match current or key against regular expression.
 *
 * @return whether this is a match
 */
function accept()
{
$subject = ($this-flags  self::USE_KEY) ? parent::key() : 
parent::current();
return preg_match($this-regex, $subject);
}
}

?

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/spl spl.php /ext/spl/internal recursiveregexiterator.inc

2006-07-16 Thread Marcus Boerger
helly   Sun Jul 16 19:16:40 2006 UTC

  Added files: 
/php-src/ext/spl/internal   recursiveregexiterator.inc 

  Modified files:  
/php-src/ext/splspl.php 
  Log:
  - Update docu
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl.php?r1=1.72r2=1.73diff_format=u
Index: php-src/ext/spl/spl.php
diff -u php-src/ext/spl/spl.php:1.72 php-src/ext/spl/spl.php:1.73
--- php-src/ext/spl/spl.php:1.72Sat Mar  4 22:56:11 2006
+++ php-src/ext/spl/spl.php Sun Jul 16 19:16:40 2006
@@ -46,6 +46,8 @@
  * - class EmptyIterator implements Iterator
  * - class InfiniteIterator extends IteratorIterator
  * - class AppendIterator implements OuterIterator
+ * - class RegexIterator extends FilterIterator
+ * - class RegursiveRegexIterator extends RegexIterator implements 
RecursiveIterator
  * 
  * 2) Directories and Files
  * 

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/internal/recursiveregexiterator.inc?view=markuprev=1.1
Index: php-src/ext/spl/internal/recursiveregexiterator.inc
+++ php-src/ext/spl/internal/recursiveregexiterator.inc
?php

/** @file recursiveregexiterator.inc
 * @ingroup SPL
 * @brief class RegexIterator
 * @author  Marcus Boerger
 * @date2003 - 2006
 *
 * SPL - Standard PHP Library
 */

/**
 * @brief   Recursive regular expression filter for iterators
 * @author  Marcus Boerger
 * @version 1.0
 * @since PHP 5.1
 *
 * This filter iterator assumes that the inner iterator 
 */
class RecursiveRegexIterator extends RegexIterator implements RecursiveIterator
{
/**
 * Constructs a regular expression filter around an iterator whose 
 * elemnts or keys are strings.
 *
 * @param it Object that implements at least
 */
function __construct(RecursiveIterator $it, $regex, $flags = 0, $mode = 
0, $preg_flags = 0) {
parent::__construct($it, $regex, $flags, $mode, $preg_flags);
}

/** @return whether the current element has children
 */
function hasChildren()
{
return $this-getInnerIterator()-hasChildren();
}

/** @return an iterator for the current elements children
 *
 * @note the returned iterator will be of the same class as $this
 */
function getChildren()
{
if (empty($this-ref))
{
$this-ref = new ReflectionClass($this);
}
return 
$this-ref-newInstance($this-getInnerIterator()-getChildren());
}

private $ref;
}

?

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/pcre php_pcre.c php_pcre.h /ext/pcre/pcrelib .cvsignore

2006-07-16 Thread Marcus Boerger
helly   Sun Jul 16 19:20:05 2006 UTC

  Modified files:  
/php-src/ext/pcre   php_pcre.c php_pcre.h 
/php-src/ext/pcre/pcrelib   .cvsignore 
  Log:
  - Little bit refactoring: Two new PHPAPI functions:
. php_pcre_match
. php_pcre_split
  
  http://cvs.php.net/viewvc.cgi/php-src/ext/pcre/php_pcre.c?r1=1.186r2=1.187diff_format=u
Index: php-src/ext/pcre/php_pcre.c
diff -u php-src/ext/pcre/php_pcre.c:1.186 php-src/ext/pcre/php_pcre.c:1.187
--- php-src/ext/pcre/php_pcre.c:1.186   Thu Jun 15 15:35:49 2006
+++ php-src/ext/pcre/php_pcre.c Sun Jul 16 19:20:05 2006
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_pcre.c,v 1.186 2006/06/15 15:35:49 nlopess Exp $ */
+/* $Id: php_pcre.c,v 1.187 2006/07/16 19:20:05 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -426,41 +426,22 @@
 }
 /* }}} */
 
-/* {{{ php_pcre_match
- */
-static void php_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global)
+static void php_do_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global) /* {{{ 
*/
 {
/* parameters */
char*regex; /* Regular 
expression */
char*subject;   /* String to match 
against */
int  regex_len;
int  subject_len;
-   zval*subpats = NULL;/* Array for 
subpatterns */
-   long flags; /* Match 
control flags */
-
-   zval*result_set,/* Holds a set of 
subpatterns after
-   
   a global match */
-  **match_sets = NULL; /* An array of sets of 
matches for each
-   
   subpattern after a global match */
pcre*re = NULL; /* Compiled 
regular expression */
pcre_extra  *extra = NULL;  /* Holds results of 
studying pattern */
-   pcre_extra   extra_data;/* Used locally for 
exec options */
-   int  exoptions = 0; /* Execution 
options */
+   zval*subpats = NULL;/* Array for 
subpatterns */
+   long flags; /* Match 
control flags */
int  preg_options = 0;  /* Custom preg 
options */
-   int  count = 0; /* 
Count of matched subpatterns */
-   int *offsets;   /* 
Array of subpattern offsets */
-   int  num_subpats;   /* Number of 
captured subpatterns */
-   int  size_offsets;  /* Size of the 
offsets array */
long start_offset = 0;  /* Where the new search 
starts */
-   int  matched;   /* Has 
anything matched */
int  subpats_order = 0; /* Order of 
subpattern matches */
int  offset_capture = 0;/* Capture match 
offsets: yes/no */
-   int  g_notempty = 0;/* If the match 
should not be empty */
-   const char **stringlist;/* Holds list of 
subpatterns */
-   char*match; /* The current 
match */
-   char   **subpat_names = NULL;/* Array for named subpatterns 
*/
-   int  i, rc;
-   
+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ((global) ? 
ssz|ll : ss|zll), regex, regex_len,
  subject, 
subject_len, subpats, flags, start_offset) == FAILURE) {
RETURN_FALSE;
@@ -485,6 +466,36 @@
}
}
 
+   /* Compile regex or get it from cache. */
+   if ((re = pcre_get_compiled_regex(regex, extra, preg_options 
TSRMLS_CC)) == NULL) {
+   RETURN_FALSE;
+   }
+
+   php_pcre_match(re, extra, subject, subject_len, return_value, subpats, 
+   global, preg_options, start_offset, subpats_order, 
offset_capture TSRMLS_CC);
+}
+
+PHPAPI void php_pcre_match(pcre *re, pcre_extra *extra, char *subject, int 
subject_len, zval *return_value,
+   zval *subpats, int global, int preg_options, long start_offset, int 
subpats_order, int offset_capture TSRMLS_DC)
+{
+
+   zval*result_set,/* Holds a set of 
subpatterns after
+   
   a global match */
+   

[PHP-CVS] cvs: php-src(PHP_5_2) /ext/pcre/tests grep2.phpt split.phpt split2.phpt

2006-07-16 Thread Nuno Lopes
nlopess Sun Jul 16 19:35:09 2006 UTC

  Added files: (Branch: PHP_5_2)
/php-src/ext/pcre/tests grep2.phpt split.phpt split2.phpt 
  Log:
  new tests. almost 90% of code coverage
  

http://cvs.php.net/viewvc.cgi/php-src/ext/pcre/tests/grep2.phpt?view=markuprev=1.1
Index: php-src/ext/pcre/tests/grep2.phpt
+++ php-src/ext/pcre/tests/grep2.phpt

http://cvs.php.net/viewvc.cgi/php-src/ext/pcre/tests/split.phpt?view=markuprev=1.1
Index: php-src/ext/pcre/tests/split.phpt
+++ php-src/ext/pcre/tests/split.phpt

http://cvs.php.net/viewvc.cgi/php-src/ext/pcre/tests/split2.phpt?view=markuprev=1.1
Index: php-src/ext/pcre/tests/split2.phpt
+++ php-src/ext/pcre/tests/split2.phpt

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/pcre/tests grep2.phpt split.phpt split2.phpt

2006-07-16 Thread Nuno Lopes
nlopess Sun Jul 16 19:36:23 2006 UTC

  Modified files:  
/php-src/ext/pcre/tests grep2.phpt split.phpt split2.phpt 
  Log:
  MFB
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pcre/tests/grep2.phpt?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/pcre/tests/grep2.phpt
diff -u /dev/null php-src/ext/pcre/tests/grep2.phpt:1.2
--- /dev/null   Sun Jul 16 19:36:23 2006
+++ php-src/ext/pcre/tests/grep2.phpt   Sun Jul 16 19:36:23 2006
@@ -0,0 +1,45 @@
+--TEST--
+preg_grep() 2nd test
+--FILE--
+?php
+
+var_dump(preg_grep(1,array(),3,4));
+var_dump(preg_grep(1, 2));
+var_dump(preg_grep('/+/', array()));
+
+$array = array(5='a', 'x' = '1', 'xyz'='q6', 'h20');
+
+var_dump(preg_grep('@^[a-z]+@', $array));
+var_dump(preg_grep('@^[a-z]+@', $array, PREG_GREP_INVERT));
+
+ini_set('pcre.recursion_limit', 1);
+var_dump(preg_last_error() == PREG_NO_ERROR);
+var_dump(preg_grep('@^[a-z]+@', $array));
+var_dump(preg_last_error() == PREG_RECURSION_LIMIT_ERROR);
+
+?
+--EXPECTF--
+Warning: Wrong parameter count for preg_grep() in %sgrep2.php on line 3
+NULL
+
+Warning: preg_grep(): Second argument to preg_grep() should be an array in 
%sgrep2.php on line 4
+NULL
+
+Warning: preg_grep(): Compilation failed: nothing to repeat at offset 0 in 
%sgrep2.php on line 5
+bool(false)
+array(3) {
+  [5]=
+  string(1) a
+  [xyz]=
+  string(2) q6
+  [6]=
+  string(3) h20
+}
+array(1) {
+  [x]=
+  string(1) 1
+}
+bool(true)
+array(0) {
+}
+bool(true)
http://cvs.php.net/viewvc.cgi/php-src/ext/pcre/tests/split.phpt?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/pcre/tests/split.phpt
diff -u /dev/null php-src/ext/pcre/tests/split.phpt:1.2
--- /dev/null   Sun Jul 16 19:36:23 2006
+++ php-src/ext/pcre/tests/split.phpt   Sun Jul 16 19:36:23 2006
@@ -0,0 +1,86 @@
+--TEST--
+preg_split()
+--FILE--
+?php
+
+var_dump(preg_split());
+var_dump(preg_split('/*/', 'x'));
+
+var_dump(preg_split('/[\s, ]+/', 'x yy,zzz'));
+var_dump(preg_split('/[\s, ]+/', 'x yy,zzz', -1));
+var_dump(preg_split('/[\s, ]+/', 'x yy,zzz', 0));
+var_dump(preg_split('/[\s, ]+/', 'x yy,zzz', 1));
+var_dump(preg_split('/[\s, ]+/', 'x yy,zzz', 2));
+
+var_dump(preg_split('/\d*/', 'ab2c3u'));
+var_dump(preg_split('/\d*/', 'ab2c3u', -1, PREG_SPLIT_NO_EMPTY));
+
+?
+--EXPECTF--
+Warning: Wrong parameter count for preg_split() in %ssplit.php on line 3
+NULL
+
+Warning: preg_split(): Compilation failed: nothing to repeat at offset 0 in 
%ssplit.php on line 4
+bool(false)
+array(3) {
+  [0]=
+  string(1) x
+  [1]=
+  string(2) yy
+  [2]=
+  string(3) zzz
+}
+array(3) {
+  [0]=
+  string(1) x
+  [1]=
+  string(2) yy
+  [2]=
+  string(3) zzz
+}
+array(3) {
+  [0]=
+  string(1) x
+  [1]=
+  string(2) yy
+  [2]=
+  string(3) zzz
+}
+array(1) {
+  [0]=
+  string(8) x yy,zzz
+}
+array(2) {
+  [0]=
+  string(1) x
+  [1]=
+  string(6) yy,zzz
+}
+array(8) {
+  [0]=
+  string(0) 
+  [1]=
+  string(1) a
+  [2]=
+  string(1) b
+  [3]=
+  string(0) 
+  [4]=
+  string(1) c
+  [5]=
+  string(0) 
+  [6]=
+  string(1) u
+  [7]=
+  string(0) 
+}
+array(4) {
+  [0]=
+  string(1) a
+  [1]=
+  string(1) b
+  [2]=
+  string(1) c
+  [3]=
+  string(1) u
+}
http://cvs.php.net/viewvc.cgi/php-src/ext/pcre/tests/split2.phpt?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/pcre/tests/split2.phpt
diff -u /dev/null php-src/ext/pcre/tests/split2.phpt:1.2
--- /dev/null   Sun Jul 16 19:36:23 2006
+++ php-src/ext/pcre/tests/split2.phpt  Sun Jul 16 19:36:23 2006
@@ -0,0 +1,315 @@
+--TEST--
+preg_split() 2nd test
+--FILE--
+?php
+
+var_dump(preg_split('/(\d*)/', 'ab2c3u', -1, PREG_SPLIT_DELIM_CAPTURE));
+var_dump(preg_split('/(\d*)/', 'ab2c3u', -1, PREG_SPLIT_OFFSET_CAPTURE));
+var_dump(preg_split('/(\d*)/', 'ab2c3u', -1, PREG_SPLIT_NO_EMPTY | 
PREG_SPLIT_DELIM_CAPTURE));
+var_dump(preg_split('/(\d*)/', 'ab2c3u', -1, PREG_SPLIT_NO_EMPTY | 
PREG_SPLIT_OFFSET_CAPTURE));;
+var_dump(preg_split('/(\d*)/', 'ab2c3u', -1, PREG_SPLIT_DELIM_CAPTURE | 
PREG_SPLIT_OFFSET_CAPTURE));
+var_dump(preg_split('/(\d*)/', 'ab2c3u', -1, PREG_SPLIT_NO_EMPTY | 
PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_OFFSET_CAPTURE));
+
+
+var_dump(preg_last_error(1));
+ini_set('pcre.recursion_limit', 1);
+var_dump(preg_last_error() == PREG_NO_ERROR);
+var_dump(preg_split('/(\d*)/', 'ab2c3u'));
+var_dump(preg_last_error() == PREG_RECURSION_LIMIT_ERROR);
+
+?
+--EXPECTF--
+array(15) {
+  [0]=
+  string(0) 
+  [1]=
+  string(0) 
+  [2]=
+  string(1) a
+  [3]=
+  string(0) 
+  [4]=
+  string(1) b
+  [5]=
+  string(1) 2
+  [6]=
+  string(0) 
+  [7]=
+  string(0) 
+  [8]=
+  string(1) c
+  [9]=
+  string(1) 3
+  [10]=
+  string(0) 
+  [11]=
+  string(0) 
+  [12]=
+  string(1) u
+  [13]=
+  string(0) 
+  [14]=
+  string(0) 
+}
+array(8) {
+  [0]=
+  array(2) {
+[0]=
+string(0) 
+[1]=
+int(0)
+  }
+  [1]=
+  array(2) {
+[0]=
+string(1) a
+[1]=
+int(0)
+  }
+  [2]=
+  array(2) {
+[0]=
+string(1) b
+[1]=
+int(1)
+  }
+  [3]=
+  array(2) {
+[0]=
+string(0) 
+[1]=
+int(3)
+  }
+  [4]=
+  array(2) {
+  

[PHP-CVS] cvs: php-src /ext/spl/tests iterator_049.phpt

2006-07-16 Thread Marcus Boerger
helly   Sun Jul 16 19:50:43 2006 UTC

  Added files: 
/php-src/ext/spl/tests  iterator_049.phpt 
  Log:
  - This test fails right now and requires a zend API change to fix
  

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/iterator_049.phpt?view=markuprev=1.1
Index: php-src/ext/spl/tests/iterator_049.phpt
+++ php-src/ext/spl/tests/iterator_049.phpt
--TEST--
SPL: ArrayIterator with NULL key
--SKIPIF--
?php if (!extension_loaded(spl)) print skip; ?
--FILE--
?php

$ar = new ArrayIterator(array(NULL=NULL));
var_dump($ar);
var_dump($ar-getArrayCopy());

?
===DONE===
?php exit(0); ?
--EXPECTF--
object(ArrayIterator)#1 (1) {
  []=
  NULL
}
array(1) {
  []=
  NULL
}
===DONE===


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/spl spl_iterators.c spl_iterators.h /ext/spl/internal regexiterator.inc /ext/spl/tests iterator_050.phpt iterator_051.phpt iterator_052.phpt iterator_053.phpt iterator_05

2006-07-16 Thread Marcus Boerger
helly   Sun Jul 16 20:52:21 2006 UTC

  Added files: 
/php-src/ext/spl/tests  iterator_050.phpt iterator_051.phpt 
iterator_052.phpt iterator_053.phpt 
iterator_054.phpt iterator_055.phpt 

  Modified files:  
/php-src/ext/splspl_iterators.c spl_iterators.h 
/php-src/ext/spl/internal   regexiterator.inc 
  Log:
  - Upgrade RegexIterator capabilities, see docu
  http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_iterators.c?r1=1.137r2=1.138diff_format=u
Index: php-src/ext/spl/spl_iterators.c
diff -u php-src/ext/spl/spl_iterators.c:1.137 
php-src/ext/spl/spl_iterators.c:1.138
--- php-src/ext/spl/spl_iterators.c:1.137   Tue Jun  6 20:12:46 2006
+++ php-src/ext/spl/spl_iterators.c Sun Jul 16 20:52:20 2006
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_iterators.c,v 1.137 2006/06/06 20:12:46 tony2001 Exp $ */
+/* $Id: spl_iterators.c,v 1.138 2006/07/16 20:52:20 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -1005,12 +1005,20 @@
char *regex;
int len, poptions, coptions;
pcre_extra *extra = NULL;
+   long mode = REGIT_MODE_MATCH;
 
intern-u.regex.flags = 0;
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, 
Os|l, zobject, ce_inner, regex, len, intern-u.regex.flags) == FAILURE) {
+   intern-u.regex.preg_flags = 0;
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, 
Os|lll, zobject, ce_inner, regex, len, intern-u.regex.flags, mode, 
intern-u.regex.preg_flags) == FAILURE) {
php_set_error_handling(EH_NORMAL, NULL 
TSRMLS_CC);
return NULL;
}
+   if (mode  0 || mode = REGIT_MODE_MAX) {
+   
zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, Illegal 
mode %ld, mode);
+   php_set_error_handling(EH_NORMAL, NULL 
TSRMLS_CC);
+   return NULL;
+   }
+   intern-u.regex.mode = mode;
intern-u.regex.regex = estrndup(regex, len);
intern-u.regex.pce = 
pcre_get_compiled_regex_cache(regex, len, extra, poptions, coptions 
TSRMLS_CC);
intern-u.regex.pce-refcount++;
@@ -1368,7 +1376,7 @@
 } /* }}} */
 
 #if HAVE_PCRE || HAVE_BUNDLED_PCRE
-/* {{{ proto void RegexIterator::__construct(Iterator it, string $regex [, int 
$flags]) 
+/* {{{ proto void RegexIterator::__construct(Iterator it, string regex [, int 
flags [, int mode [, int preg_flags]]]) 
Create an RegexIterator from another iterator and a regular expression */
 SPL_METHOD(RegexIterator, __construct)
 {
@@ -1379,23 +1387,36 @@
Match (string)current() against regular expression */
 SPL_METHOD(RegexIterator, accept)
 {
-   spl_dual_it_object   *intern;
-   int count;
-   char *subject, tmp[32];
-   int subject_len, use_copy = 0;
-   zval subject_copy;
-   pcre_extra *extra;
+   spl_dual_it_object *intern = 
(spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
+   char   *subject, tmp[32];
+   intsubject_len, use_copy, count;
+   zval   subject_copy, zcount;
+   pcre   *regex = intern-u.regex.pce-re;
+   pcre_extra *extra = intern-u.regex.pce-extra;
 
-   intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() 
TSRMLS_CC);
-   
if (intern-u.regex.flags  REGIT_USE_KEY) {
if (intern-current.key_type == HASH_KEY_IS_LONG) {
subject_len = snprintf(tmp, sizeof(tmp), %ld, 
intern-current.int_key);
subject = tmp[0];
+   use_copy = 0;
+   } else if (intern-current.key_type == HASH_KEY_IS_UNICODE) {
+   subject_len = intern-current.str_key_len - 1;
+   subject = 
zend_unicode_to_ascii(intern-current.str_key.u, subject_len TSRMLS_DC);
+   if (!subject) {
+   /* FIXME: Unicode support??? : how to handle 
this error, with that exception? */
+   if (intern-u.regex.mode != REGIT_MODE_MATCH) {
+   zval_ptr_dtor(intern-current.data);
+   MAKE_STD_ZVAL(intern-current.data);
+   array_init(intern-current.data);
+   }
+   
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, Unicode 
key could not be converted to ascii);
+   RETURN_FALSE;
+  

[PHP-CVS] cvs: php-src /ext/pcre php_pcre.h

2006-07-16 Thread Marcus Boerger
helly   Sun Jul 16 20:57:40 2006 UTC

  Modified files:  
/php-src/ext/pcre   php_pcre.h 
  Log:
  - TSRM Fix
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pcre/php_pcre.h?r1=1.46r2=1.47diff_format=u
Index: php-src/ext/pcre/php_pcre.h
diff -u php-src/ext/pcre/php_pcre.h:1.46 php-src/ext/pcre/php_pcre.h:1.47
--- php-src/ext/pcre/php_pcre.h:1.46Sun Jul 16 19:20:05 2006
+++ php-src/ext/pcre/php_pcre.h Sun Jul 16 20:57:40 2006
@@ -16,7 +16,7 @@
+--+
  */
  
-/* $Id: php_pcre.h,v 1.46 2006/07/16 19:20:05 helly Exp $ */
+/* $Id: php_pcre.h,v 1.47 2006/07/16 20:57:40 helly Exp $ */
 
 #ifndef PHP_PCRE_H
 #define PHP_PCRE_H
@@ -44,7 +44,7 @@
 PHPAPI char *php_pcre_replace(char *regex,   int regex_len, char *subject, int 
subject_len, zval *replace_val, int is_callable_replace, int *result_len, int 
limit, int *replace_count TSRMLS_DC);
 PHPAPI pcre* pcre_get_compiled_regex(char *regex, pcre_extra **extra, int 
*options TSRMLS_DC);
 PHPAPI pcre* pcre_get_compiled_regex_ex(char *regex, pcre_extra **extra, int 
*preg_options, int *coptions TSRMLS_DC);
-PHPAPI void  php_pcre_split(pcre *re, pcre_extra *extra, char *subject, int 
subject_len, zval *return_value TSRMLS_DC,
+PHPAPI void  php_pcre_split(pcre *re, pcre_extra *extra, char *subject, int 
subject_len, zval *return_value,
int coptions, int limit_val, int no_empty, int delim_capture, int 
offset_capture TSRMLS_DC);
 PHPAPI void php_pcre_match(pcre *re, pcre_extra *extra, char *subject, int 
subject_len, zval *return_value,
zval *subpats, int global, int preg_options, long start_offset, int 
subpats_order, int offset_capture TSRMLS_DC);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/pcre php_pcre.c php_pcre.h

2006-07-16 Thread Marcus Boerger
helly   Sun Jul 16 21:09:30 2006 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/pcre   php_pcre.c php_pcre.h 
  Log:
  - MFH: Little bit refactoring: Two new PHPAPI functions:
. php_pcre_match
. php_pcre_split
  
  http://cvs.php.net/viewvc.cgi/php-src/ext/pcre/php_pcre.c?r1=1.168.2.9.2.7r2=1.168.2.9.2.8diff_format=u
Index: php-src/ext/pcre/php_pcre.c
diff -u php-src/ext/pcre/php_pcre.c:1.168.2.9.2.7 
php-src/ext/pcre/php_pcre.c:1.168.2.9.2.8
--- php-src/ext/pcre/php_pcre.c:1.168.2.9.2.7   Thu Jun 15 18:33:08 2006
+++ php-src/ext/pcre/php_pcre.c Sun Jul 16 21:09:30 2006
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_pcre.c,v 1.168.2.9.2.7 2006/06/15 18:33:08 dmitry Exp $ */
+/* $Id: php_pcre.c,v 1.168.2.9.2.8 2006/07/16 21:09:30 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -426,41 +426,22 @@
 }
 /* }}} */
 
-/* {{{ php_pcre_match
- */
-static void php_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global)
+static void php_do_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global) /* {{{ 
*/
 {
/* parameters */
char*regex; /* Regular 
expression */
char*subject;   /* String to match 
against */
int  regex_len;
int  subject_len;
-   zval*subpats = NULL;/* Array for 
subpatterns */
-   long flags; /* Match 
control flags */
-
-   zval*result_set,/* Holds a set of 
subpatterns after
-   
   a global match */
-  **match_sets = NULL; /* An array of sets of 
matches for each
-   
   subpattern after a global match */
pcre*re = NULL; /* Compiled 
regular expression */
pcre_extra  *extra = NULL;  /* Holds results of 
studying pattern */
-   pcre_extra   extra_data;/* Used locally for 
exec options */
-   int  exoptions = 0; /* Execution 
options */
+   zval*subpats = NULL;/* Array for 
subpatterns */
+   long flags; /* Match 
control flags */
int  preg_options = 0;  /* Custom preg 
options */
-   int  count = 0; /* 
Count of matched subpatterns */
-   int *offsets;   /* 
Array of subpattern offsets */
-   int  num_subpats;   /* Number of 
captured subpatterns */
-   int  size_offsets;  /* Size of the 
offsets array */
long start_offset = 0;  /* Where the new search 
starts */
-   int  matched;   /* Has 
anything matched */
int  subpats_order = 0; /* Order of 
subpattern matches */
int  offset_capture = 0;/* Capture match 
offsets: yes/no */
-   int  g_notempty = 0;/* If the match 
should not be empty */
-   const char **stringlist;/* Holds list of 
subpatterns */
-   char*match; /* The current 
match */
-   char   **subpat_names = NULL;/* Array for named subpatterns 
*/
-   int  i, rc;
-   
+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ((global) ? 
ssz|ll : ss|zll), regex, regex_len,
  subject, 
subject_len, subpats, flags, start_offset) == FAILURE) {
RETURN_FALSE;
@@ -485,6 +466,36 @@
}
}
 
+   /* Compile regex or get it from cache. */
+   if ((re = pcre_get_compiled_regex(regex, extra, preg_options 
TSRMLS_CC)) == NULL) {
+   RETURN_FALSE;
+   }
+
+   php_pcre_match(re, extra, subject, subject_len, return_value, subpats, 
+   global, preg_options, start_offset, subpats_order, 
offset_capture TSRMLS_CC);
+}
+
+PHPAPI void php_pcre_match(pcre *re, pcre_extra *extra, char *subject, int 
subject_len, zval *return_value,
+   zval *subpats, int global, int preg_options, long start_offset, int 
subpats_order, int offset_capture TSRMLS_DC)
+{
+
+   zval*result_set,/* Holds a set of 
subpatterns after
+   
   a global match 

[PHP-CVS] cvs: php-src(PHP_5_2) /ext/spl spl.php spl_iterators.c spl_iterators.h /ext/spl/internal filteriterator.inc recursiveregexiterator.inc regexiterator.inc /ext/spl/tests iterator_049.phpt it

2006-07-16 Thread Marcus Boerger
helly   Sun Jul 16 21:12:32 2006 UTC

  Added files: (Branch: PHP_5_2)
/php-src/ext/spl/internal   recursiveregexiterator.inc 
regexiterator.inc 
/php-src/ext/spl/tests  iterator_049.phpt iterator_050.phpt 
iterator_051.phpt iterator_052.phpt 
iterator_053.phpt iterator_054.phpt 
iterator_055.phpt 

  Modified files:  
/php-src/ext/splspl.php spl_iterators.c spl_iterators.h 
/php-src/ext/spl/internal   filteriterator.inc 
  Log:
  - MFH:
. Upgrade RegexIterator capabilities, see docu
. Update docu
. Add test (which fails right now: iterator_049.phpt)
. Add tests for new functionality
  
  http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl.php?r1=1.49.2.11r2=1.49.2.11.2.1diff_format=u
Index: php-src/ext/spl/spl.php
diff -u php-src/ext/spl/spl.php:1.49.2.11 php-src/ext/spl/spl.php:1.49.2.11.2.1
--- php-src/ext/spl/spl.php:1.49.2.11   Sun Mar  5 17:39:49 2006
+++ php-src/ext/spl/spl.php Sun Jul 16 21:12:32 2006
@@ -6,7 +6,7 @@
  *
  * SPL - Standard PHP Library
  *
- * (c) Marcus Boerger, 2003 - 2005
+ * (c) Marcus Boerger, 2003 - 2006
  */
 
 /** @mainpage SPL - Standard PHP Library
@@ -46,6 +46,8 @@
  * - class EmptyIterator implements Iterator
  * - class InfiniteIterator extends IteratorIterator
  * - class AppendIterator implements OuterIterator
+ * - class RegexIterator extends FilterIterator
+ * - class RegursiveRegexIterator extends RegexIterator implements 
RecursiveIterator
  * 
  * 2) Directories and Files
  * 
@@ -66,8 +68,8 @@
  * 
  * SPL offers advanced Array overloading:
  * 
- * - class ArrayObject implements IteratorAggregate
- * - class ArrayIterator implements Iterator
+ * - class ArrayObject implements IteratorAggregate, ArrayAccess, Countable
+ * - class ArrayIterator implements Iterator, ArrayAccess, Countable, 
SeekableIterator
  * - class RecursiveArrayIterator extends ArrayIterator implements 
RecursiveIterator
  * 
  * As the above suggest an ArrayObject creates an ArrayIterator when it comes 
to
@@ -128,7 +130,7 @@
  * You can download this documentation as a chm file 
  * a href=http://php.net/~helly/php/ext/spl/spl.chm;here/a.
  *
- * (c) Marcus Boerger, 2003 - 2005
+ * (c) Marcus Boerger, 2003 - 2006
  */
 
 /** @defgroup ZendEngine Zend engine classes
@@ -157,7 +159,7 @@
  * @param class_namename of class to load
  * @param file_extensions   file extensions (use defaults if NULL)
  */
-function spl_autoload(string $class_name, string $file_extensions = NULL);
+function spl_autoload(string $class_name, string $file_extensions = NULL) 
{/**/};
 
 /** @ingroup SPL
  * @brief Manual invocation of all registerd autoload functions
@@ -165,7 +167,7 @@
  *
  * @param class_namename of class to load
  */
-function spl_autoload_call(string $class_name);
+function spl_autoload_call(string $class_name) {/**/};
 
 /** @ingroup SPL 
  * @brief Register and return default file extensions for spl_autoload
@@ -176,7 +178,7 @@
  * @return comma separated list of file extensions to use in default autoload 
  *function.
  */
-function spl_autoload_extensions($file_extensions);
+function spl_autoload_extensions($file_extensions) {/**/};
 
 /** @ingroup SPL
  * @brief Return all registered autoload functionns
@@ -184,7 +186,7 @@
  *
  * @return array of all registered autoload functions or false
  */
-function spl_autoload_functions();
+function spl_autoload_functions() {/**/};
 
 /** @ingroup SPL
  * @brief Register given function as autoload implementation
@@ -194,7 +196,7 @@
  *   function name to register as autoload function.
  * @param throw  whether to throw or issue an error on failure.
  */
-function spl_autoload_register(string $autoload_function = spl_autoload, 
$throw = true);
+function spl_autoload_register(string $autoload_function = spl_autoload, 
$throw = true) {/**/};
 
 /** @ingroup SPL
  * @brief Unregister given function as autoload implementation
@@ -203,7 +205,7 @@
  * @param autoload_function  name of function or array of object/class and 
  *   function name to unregister as autoload function.
  */
-function spl_autoload_unregister(string $autoload_function = spl_autoload);
+function spl_autoload_unregister(string $autoload_function = spl_autoload) 
{/**/};
 
 /** @ingroup SPL
  * @brief Return an array of classes and interfaces in SPL
@@ -211,7 +213,7 @@
  * @return array containing the names of all clsses and interfaces defined in 
  * extension SPL
  */
-function spl_classes();
+function spl_classes() {/**/};
 
 /** @ingroup SPL
  * @brief Count the elements in an iterator
@@ -219,7 +221,7 @@
  *
  * @return number of elements in an iterator
  */
-function iterator_count(Traversable $it);
+function iterator_count(Traversable $it) {/**/};
 
 /** @ingroup SPL
  * @brief Copy 

[PHP-CVS] cvs: php-src /ext/spl/internal recursiveregexiterator.inc regexiterator.inc

2006-07-16 Thread Marcus Boerger
helly   Sun Jul 16 23:45:30 2006 UTC

  Modified files:  
/php-src/ext/spl/internal   recursiveregexiterator.inc 
regexiterator.inc 
  Log:
  - Update docu
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/internal/recursiveregexiterator.inc?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/spl/internal/recursiveregexiterator.inc
diff -u php-src/ext/spl/internal/recursiveregexiterator.inc:1.1 
php-src/ext/spl/internal/recursiveregexiterator.inc:1.2
--- php-src/ext/spl/internal/recursiveregexiterator.inc:1.1 Sun Jul 16 
19:16:40 2006
+++ php-src/ext/spl/internal/recursiveregexiterator.inc Sun Jul 16 23:45:29 2006
@@ -23,7 +23,13 @@
 * Constructs a regular expression filter around an iterator whose 
 * elemnts or keys are strings.
 *
-* @param it Object that implements at least
+* @param it  inner iterator
+* @param regex   the regular expression to match
+* @param flags   special flags (self::USE_KEY)
+* @param modeoperation mode (one of self::MATCH, 
self::GET_MATCH, 
+*self::ALL_MATCHES, self::SPLIT)
+* @param preg_flags  global PREG_* flags, see preg_match(), 
+*preg_match_all(), preg_split()
 */
function __construct(RecursiveIterator $it, $regex, $flags = 0, $mode = 
0, $preg_flags = 0) {
parent::__construct($it, $regex, $flags, $mode, $preg_flags);
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/internal/regexiterator.inc?r1=1.2r2=1.3diff_format=u
Index: php-src/ext/spl/internal/regexiterator.inc
diff -u php-src/ext/spl/internal/regexiterator.inc:1.2 
php-src/ext/spl/internal/regexiterator.inc:1.3
--- php-src/ext/spl/internal/regexiterator.inc:1.2  Sun Jul 16 20:52:20 2006
+++ php-src/ext/spl/internal/regexiterator.inc  Sun Jul 16 23:45:29 2006
@@ -19,24 +19,33 @@
  */
 class RegexIterator implements FilterIterator
 {
-   const USE_KEY = 0x0001;
+   const USE_KEY = 0x0001; /** If present in $flags the the key 
is 
+used rather then the current 
value. */
 
-   const MATCH   = 0;
-   const GET_MATCH   = 1;
-   const ALL_MATCHES = 2;
-   const SPLIT   = 3;
+   const MATCH   = 0; /** Mode: Executed a plain match only  */
+   const GET_MATCH   = 1; /** Mode: Return the first matche (if any) */
+   const ALL_MATCHES = 2; /** Mode: Return all matches (if any)  */
+   const SPLIT   = 3; /** Mode: Return the split values (if any) */

private $regex; /** the regular expression to match against */
-   private $flags; /** special flags (USE_KEY) */
-   private $mode;  /** operation mode (MATCH, GET_MATCH, ALL_MATCHES, 
SPLIT) */
-   private $preg_flags;/** PREG_* flags, see preg_match(), 
preg_match_all(), preg_split() */ 
+   private $flags; /** special flags (self::USE_KEY) */
+   private $mode;  /** operation mode (one of self::MATCH, 
+self::GET_MATCH, self::ALL_MATCHES, 
self::SPLIT) */
+   private $preg_flags;/** PREG_* flags, see preg_match(), 
preg_match_all(), 
+preg_split() */ 
private $current;   /** the value used for current() */
 
/**
 * Constructs a regular expression filter around an iterator whose 
 * elemnts or keys are strings.
 *
-* @param it Object that implements at least
+* @param it  inner iterator
+* @param regex   the regular expression to match
+* @param flags   special flags (self::USE_KEY)
+* @param modeoperation mode (one of self::MATCH, 
self::GET_MATCH, 
+*self::ALL_MATCHES, self::SPLIT)
+* @param preg_flags  global PREG_* flags, see preg_match(), 
+*preg_match_all(), preg_split()
 */
function __construct(Iterator $it, $regex, $flags = 0, $mode = 0, 
$preg_flags = 0) {
parent::__construct($it);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/spl/internal recursiveregexiterator.inc regexiterator.inc

2006-07-16 Thread Marcus Boerger
helly   Sun Jul 16 23:46:12 2006 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/spl/internal   recursiveregexiterator.inc 
regexiterator.inc 
  Log:
  - MFH Update docu
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/internal/recursiveregexiterator.inc?r1=1.1.2.2r2=1.1.2.3diff_format=u
Index: php-src/ext/spl/internal/recursiveregexiterator.inc
diff -u php-src/ext/spl/internal/recursiveregexiterator.inc:1.1.2.2 
php-src/ext/spl/internal/recursiveregexiterator.inc:1.1.2.3
--- php-src/ext/spl/internal/recursiveregexiterator.inc:1.1.2.2 Sun Jul 16 
21:12:32 2006
+++ php-src/ext/spl/internal/recursiveregexiterator.inc Sun Jul 16 23:46:12 2006
@@ -23,7 +23,13 @@
 * Constructs a regular expression filter around an iterator whose 
 * elemnts or keys are strings.
 *
-* @param it Object that implements at least
+* @param it  inner iterator
+* @param regex   the regular expression to match
+* @param flags   special flags (self::USE_KEY)
+* @param modeoperation mode (one of self::MATCH, 
self::GET_MATCH, 
+*self::ALL_MATCHES, self::SPLIT)
+* @param preg_flags  global PREG_* flags, see preg_match(), 
+*preg_match_all(), preg_split()
 */
function __construct(RecursiveIterator $it, $regex, $flags = 0, $mode = 
0, $preg_flags = 0) {
parent::__construct($it, $regex, $flags, $mode, $preg_flags);
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/internal/regexiterator.inc?r1=1.2.2.2r2=1.2.2.3diff_format=u
Index: php-src/ext/spl/internal/regexiterator.inc
diff -u php-src/ext/spl/internal/regexiterator.inc:1.2.2.2 
php-src/ext/spl/internal/regexiterator.inc:1.2.2.3
--- php-src/ext/spl/internal/regexiterator.inc:1.2.2.2  Sun Jul 16 21:12:32 2006
+++ php-src/ext/spl/internal/regexiterator.inc  Sun Jul 16 23:46:12 2006
@@ -19,24 +19,33 @@
  */
 class RegexIterator implements FilterIterator
 {
-   const USE_KEY = 0x0001;
+   const USE_KEY = 0x0001; /** If present in $flags the the key 
is 
+used rather then the current 
value. */
 
-   const MATCH   = 0;
-   const GET_MATCH   = 1;
-   const ALL_MATCHES = 2;
-   const SPLIT   = 3;
+   const MATCH   = 0; /** Mode: Executed a plain match only  */
+   const GET_MATCH   = 1; /** Mode: Return the first matche (if any) */
+   const ALL_MATCHES = 2; /** Mode: Return all matches (if any)  */
+   const SPLIT   = 3; /** Mode: Return the split values (if any) */

private $regex; /** the regular expression to match against */
-   private $flags; /** special flags (USE_KEY) */
-   private $mode;  /** operation mode (MATCH, GET_MATCH, ALL_MATCHES, 
SPLIT) */
-   private $preg_flags;/** PREG_* flags, see preg_match(), 
preg_match_all(), preg_split() */ 
+   private $flags; /** special flags (self::USE_KEY) */
+   private $mode;  /** operation mode (one of self::MATCH, 
+self::GET_MATCH, self::ALL_MATCHES, 
self::SPLIT) */
+   private $preg_flags;/** PREG_* flags, see preg_match(), 
preg_match_all(), 
+preg_split() */ 
private $current;   /** the value used for current() */
 
/**
 * Constructs a regular expression filter around an iterator whose 
 * elemnts or keys are strings.
 *
-* @param it Object that implements at least
+* @param it  inner iterator
+* @param regex   the regular expression to match
+* @param flags   special flags (self::USE_KEY)
+* @param modeoperation mode (one of self::MATCH, 
self::GET_MATCH, 
+*self::ALL_MATCHES, self::SPLIT)
+* @param preg_flags  global PREG_* flags, see preg_match(), 
+*preg_match_all(), preg_split()
 */
function __construct(Iterator $it, $regex, $flags = 0, $mode = 0, 
$preg_flags = 0) {
parent::__construct($it);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/spl spl.php

2006-07-16 Thread Marcus Boerger
helly   Sun Jul 16 23:48:15 2006 UTC

  Modified files:  
/php-src/ext/splspl.php 
  Log:
  -Typo
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl.php?r1=1.73r2=1.74diff_format=u
Index: php-src/ext/spl/spl.php
diff -u php-src/ext/spl/spl.php:1.73 php-src/ext/spl/spl.php:1.74
--- php-src/ext/spl/spl.php:1.73Sun Jul 16 19:16:40 2006
+++ php-src/ext/spl/spl.php Sun Jul 16 23:48:15 2006
@@ -47,7 +47,7 @@
  * - class InfiniteIterator extends IteratorIterator
  * - class AppendIterator implements OuterIterator
  * - class RegexIterator extends FilterIterator
- * - class RegursiveRegexIterator extends RegexIterator implements 
RecursiveIterator
+ * - class RecursiveRegexIterator extends RegexIterator implements 
RecursiveIterator
  * 
  * 2) Directories and Files
  * 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/spl spl.php

2006-07-16 Thread Marcus Boerger
helly   Sun Jul 16 23:48:34 2006 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/splspl.php 
  Log:
  - MFH Typo
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl.php?r1=1.49.2.11.2.1r2=1.49.2.11.2.2diff_format=u
Index: php-src/ext/spl/spl.php
diff -u php-src/ext/spl/spl.php:1.49.2.11.2.1 
php-src/ext/spl/spl.php:1.49.2.11.2.2
--- php-src/ext/spl/spl.php:1.49.2.11.2.1   Sun Jul 16 21:12:32 2006
+++ php-src/ext/spl/spl.php Sun Jul 16 23:48:34 2006
@@ -47,7 +47,7 @@
  * - class InfiniteIterator extends IteratorIterator
  * - class AppendIterator implements OuterIterator
  * - class RegexIterator extends FilterIterator
- * - class RegursiveRegexIterator extends RegexIterator implements 
RecursiveIterator
+ * - class RecursiveRegexIterator extends RegexIterator implements 
RecursiveIterator
  * 
  * 2) Directories and Files
  * 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /scripts phpize.in

2006-07-16 Thread Jon Parise
jon Mon Jul 17 00:46:00 2006 UTC

  Modified files:  
/php-src/scriptsphpize.in 
  Log:
  Wrapping the $PHP_AUTOCONF and $PHP_AUTOHEADER error messages to fit
  within 80 columns.
  
  
http://cvs.php.net/viewvc.cgi/php-src/scripts/phpize.in?r1=1.30r2=1.31diff_format=u
Index: php-src/scripts/phpize.in
diff -u php-src/scripts/phpize.in:1.30 php-src/scripts/phpize.in:1.31
--- php-src/scripts/phpize.in:1.30  Mon Dec 12 11:51:18 2005
+++ php-src/scripts/phpize.in   Mon Jul 17 00:46:00 2006
@@ -104,16 +104,17 @@
   
   if ! test -x `$php_shtool path $PHP_AUTOCONF`; then
 cat EOF
-Cannot find autoconf. Please check your autoconf installation and the 
\$PHP_AUTOCONF 
-environment variable is set correctly and then rerun this script. 
+Cannot find autoconf. Please check your autoconf installation and the
+\$PHP_AUTOCONF environment variable is set correctly and then rerun this 
script.
 
 EOF
 exit 1
   fi
   if ! test -x `$php_shtool path $PHP_AUTOHEADER`; then
 cat EOF
-Cannot find autoheader. Please check your autoconf installation and the 
\$PHP_AUTOHEADER 
-environment variable is set correctly and then rerun this script. 
+Cannot find autoheader. Please check your autoconf installation and the
+\$PHP_AUTOHEADER environment variable is set correctly and then rerun this
+script.
 
 EOF
 exit 1

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /scripts phpize.in

2006-07-16 Thread Jon Parise
jon Mon Jul 17 01:17:00 2006 UTC

  Modified files:  
/php-src/scriptsphpize.in 
  Log:
  If the $PHP_AUTOCONF and $PHP_AUTOHEADER environmental variables are set
  to full paths, the `shtool path` test would fail (because it only tests
  for the existence of a bare filename in the current $PATH).  We now test
  the the executability of $PHP_AUTOCONF and $PHP_AUTOHEADER before falling
  back to the `shtool path` test.
  
  Later on, phpize will execute $PHP_AUTOCONF and $PHP_AUTOHEADER directly,
  so they will work fine as either absolute paths or files within $PATH.
  
  Also, improving the grammar of the error messages in the failure cases.
  
  
http://cvs.php.net/viewvc.cgi/php-src/scripts/phpize.in?r1=1.31r2=1.32diff_format=u
Index: php-src/scripts/phpize.in
diff -u php-src/scripts/phpize.in:1.31 php-src/scripts/phpize.in:1.32
--- php-src/scripts/phpize.in:1.31  Mon Jul 17 00:46:00 2006
+++ php-src/scripts/phpize.in   Mon Jul 17 01:17:00 2006
@@ -102,19 +102,18 @@
   test -z $PHP_AUTOCONF  PHP_AUTOCONF=autoconf
   test -z $PHP_AUTOHEADER  PHP_AUTOHEADER=autoheader
   
-  if ! test -x `$php_shtool path $PHP_AUTOCONF`; then
+  if ! text -x $PHP_AUTOCONF  ! test -x `$php_shtool path $PHP_AUTOCONF`; 
then
 cat EOF
 Cannot find autoconf. Please check your autoconf installation and the
-\$PHP_AUTOCONF environment variable is set correctly and then rerun this 
script.
+\$PHP_AUTOCONF environment variable. Then, rerun this script.
 
 EOF
 exit 1
   fi
-  if ! test -x `$php_shtool path $PHP_AUTOHEADER`; then
+  if ! test -x $PHP_AUTOHEADER  ! test -x `$php_shtool path 
$PHP_AUTOHEADER`; then
 cat EOF
 Cannot find autoheader. Please check your autoconf installation and the
-\$PHP_AUTOHEADER environment variable is set correctly and then rerun this
-script.
+\$PHP_AUTOHEADER environment variable. Then, rerun this script.
 
 EOF
 exit 1

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_2) / run-tests.php

2006-07-16 Thread Ilia Alshanetsky
iliaa   Mon Jul 17 03:57:31 2006 UTC

  Modified files:  (Branch: PHP_5_2)
/php-srcrun-tests.php 
  Log:
  Don't use regex where none is needed.
  
  
http://cvs.php.net/viewvc.cgi/php-src/run-tests.php?r1=1.226.2.37.2.4r2=1.226.2.37.2.5diff_format=u
Index: php-src/run-tests.php
diff -u php-src/run-tests.php:1.226.2.37.2.4 
php-src/run-tests.php:1.226.2.37.2.5
--- php-src/run-tests.php:1.226.2.37.2.4Wed May 24 13:28:59 2006
+++ php-src/run-tests.php   Mon Jul 17 03:57:31 2006
@@ -23,7 +23,7 @@
+--+
  */
 
-/* $Id: run-tests.php,v 1.226.2.37.2.4 2006/05/24 13:28:59 dmitry Exp $ */
+/* $Id: run-tests.php,v 1.226.2.37.2.5 2006/07/17 03:57:31 iliaa Exp $ */
 
 /* Sanity check to ensure that pcre extension needed by this script is 
available.
  * In the event it is not, print a nice error message indicating that this 
script will
@@ -397,7 +397,7 @@
$html_output = is_resource($html_file);
break;
case '--version':
-   echo '$Revision: 1.226.2.37.2.4 $'.\n;
+   echo '$Revision: 1.226.2.37.2.5 $'.\n;
exit(1);
default:
echo Illegal switch '$switch' 
specified!\n;
@@ -768,7 +768,7 @@
$url_bits = parse_url(QA_SUBMISSION_PAGE);
if (empty($url_bits['port'])) $url_bits['port'] = 80;

-   $data = php_test_data= . 
urlencode(base64_encode(preg_replace(/[\\x00]/, [0x0], $data)));
+   $data = php_test_data= . 
urlencode(base64_encode(str_replace([\\x00], [0x0], $data)));
$data_length = strlen($data);

$fs = fsockopen($url_bits['host'], $url_bits['port'], $errno, $errstr, 
10);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src / run-tests.php

2006-07-16 Thread Ilia Alshanetsky
iliaa   Mon Jul 17 03:57:53 2006 UTC

  Modified files:  
/php-srcrun-tests.php 
  Log:
  MFB: Don't use regex where none is needed.
  
  
http://cvs.php.net/viewvc.cgi/php-src/run-tests.php?r1=1.294r2=1.295diff_format=u
Index: php-src/run-tests.php
diff -u php-src/run-tests.php:1.294 php-src/run-tests.php:1.295
--- php-src/run-tests.php:1.294 Fri Jul 14 23:23:45 2006
+++ php-src/run-tests.php   Mon Jul 17 03:57:53 2006
@@ -23,7 +23,7 @@
+--+
  */
 
-/* $Id: run-tests.php,v 1.294 2006/07/14 23:23:45 andrei Exp $ */
+/* $Id: run-tests.php,v 1.295 2006/07/17 03:57:53 iliaa Exp $ */
 
 /* Sanity check to ensure that pcre extension needed by this script is 
available.
  * In the event it is not, print a nice error message indicating that this 
script will
@@ -399,7 +399,7 @@
$html_output = is_resource($html_file);
break;
case '--version':
-   echo '$Revision: 1.294 $'.\n;
+   echo '$Revision: 1.295 $'.\n;
exit(1);
default:
echo Illegal switch specified!\n;
@@ -771,7 +771,7 @@
$url_bits = parse_url(QA_SUBMISSION_PAGE);
if (empty($url_bits['port'])) $url_bits['port'] = 80;

-   $data = php_test_data= . 
urlencode(base64_encode(preg_replace(/[\\x00]/, [0x0], $data)));
+   $data = php_test_data= . 
urlencode(base64_encode(str_replace([\\x00], [0x0], $data)));
$data_length = strlen($data);

$fs = fsockopen($url_bits['host'], $url_bits['port'], $errno, $errstr, 
10);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c

2006-07-16 Thread Seiji Masugata
masugataMon Jul 17 04:44:06 2006 UTC

  Modified files:  
/php-src/ext/mbstring   mbstring.c 
  Log:
  added option parameter mb_strrpos( ).
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.258r2=1.259diff_format=u
Index: php-src/ext/mbstring/mbstring.c
diff -u php-src/ext/mbstring/mbstring.c:1.258 
php-src/ext/mbstring/mbstring.c:1.259
--- php-src/ext/mbstring/mbstring.c:1.258   Thu Jun 15 15:44:05 2006
+++ php-src/ext/mbstring/mbstring.c Mon Jul 17 04:44:06 2006
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: mbstring.c,v 1.258 2006/06/15 15:44:05 masugata Exp $ */
+/* $Id: mbstring.c,v 1.259 2006/07/17 04:44:06 masugata Exp $ */
 
 /*
  * PHP 4 Multibyte String module mbstring
@@ -1632,11 +1632,12 @@
 }
 /* }}} */
 
-/* {{{ proto int mb_strrpos(string haystack, string needle [, string encoding])
+/* {{{ proto int mb_strrpos(string haystack, string needle [, int offset [, 
string encoding]])
Find position of last occurrence of a string within another */
 PHP_FUNCTION(mb_strrpos)
 {
int n;
+   long offset = 0;
mbfl_string haystack, needle;
char *enc_name = NULL;
int enc_name_len;
@@ -1648,7 +1649,7 @@
needle.no_language = MBSTRG(current_language);
needle.no_encoding = MBSTRG(current_internal_encoding);
 
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ss|s, (char 
**)haystack.val, haystack.len, (char **)needle.val, needle.len, enc_name, 
enc_name_len) == FAILURE) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ss|ls, (char 
**)haystack.val, haystack.len, (char **)needle.val, needle.len, offset, 
enc_name, enc_name_len) == FAILURE) {
RETURN_FALSE;
}
 
@@ -1668,7 +1669,7 @@
php_error_docref(NULL TSRMLS_CC, E_WARNING,Empty needle);
RETURN_FALSE;
}
-   n = mbfl_strpos(haystack, needle, 0, 1);
+   n = mbfl_strpos(haystack, needle, offset, 1);
if (n = 0) {
RETVAL_LONG(n);
} else {

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/mbstring mbstring.c

2006-07-16 Thread Seiji Masugata
masugataMon Jul 17 04:48:17 2006 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/mbstring   mbstring.c 
  Log:
  added option parameter mb_strrpos( ).
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.224.2.22.2.8r2=1.224.2.22.2.9diff_format=u
Index: php-src/ext/mbstring/mbstring.c
diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.8 
php-src/ext/mbstring/mbstring.c:1.224.2.22.2.9
--- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.8  Fri Jun 16 16:45:46 2006
+++ php-src/ext/mbstring/mbstring.c Mon Jul 17 04:48:17 2006
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: mbstring.c,v 1.224.2.22.2.8 2006/06/16 16:45:46 masugata Exp $ */
+/* $Id: mbstring.c,v 1.224.2.22.2.9 2006/07/17 04:48:17 masugata Exp $ */
 
 /*
  * PHP 4 Multibyte String module mbstring
@@ -1632,7 +1632,7 @@
 }
 /* }}} */
 
-/* {{{ proto int mb_strrpos(string haystack, string needle [, string encoding])
+/* {{{ proto int mb_strrpos(string haystack, string needle [, int offset [, 
string encoding]])
Find the last occurrence of a character in a string within another */
 PHP_FUNCTION(mb_strrpos)
 {
@@ -1640,6 +1640,10 @@
mbfl_string haystack, needle;
char *enc_name = NULL;
int enc_name_len;
+   zval *zoffset;
+   long offset = 0, str_flg;
+   char *enc_name2 = NULL;
+   int enc_name_len2;
 
mbfl_string_init(haystack);
mbfl_string_init(needle);
@@ -1648,10 +1652,51 @@
needle.no_language = MBSTRG(current_language);
needle.no_encoding = MBSTRG(current_internal_encoding);
 
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ss|s, (char 
**)haystack.val, haystack.len, (char **)needle.val, needle.len, enc_name, 
enc_name_len) == FAILURE) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ss|zs, (char 
**)haystack.val, haystack.len, (char **)needle.val, needle.len, zoffset, 
enc_name, enc_name_len) == FAILURE) {
RETURN_FALSE;
}
 
+   if(ZEND_NUM_ARGS() = 3) {
+   if (Z_TYPE_P(zoffset) == IS_STRING) {
+   enc_name2 = Z_STRVAL_P(zoffset);
+   enc_name_len2 = Z_STRLEN_P(zoffset);
+   str_flg   = 1;
+
+   if (enc_name2 != NULL) {
+   switch (*enc_name2) {
+   case '0':
+   case '1':
+   case '2':
+   case '3':
+   case '4':
+   case '5':
+   case '6':
+   case '7':
+   case '8':
+   case '9':
+   case ' ':
+   case '-':
+   case '.':
+   break;
+   default :
+   str_flg = 0;
+   break;
+   }
+   }
+
+   if(str_flg) {
+   convert_to_long(zoffset);
+   offset   = Z_LVAL_P(zoffset);
+   } else {
+   enc_name = enc_name2;
+   enc_name_len = enc_name_len2;
+   }
+   } else {
+   convert_to_long(zoffset);
+   offset = Z_LVAL_P(zoffset);
+   }
+   }
+
if (enc_name != NULL) {
haystack.no_encoding = needle.no_encoding = 
mbfl_name2no_encoding(enc_name);
if (haystack.no_encoding == mbfl_no_encoding_invalid) {
@@ -1668,7 +1713,7 @@
php_error_docref(NULL TSRMLS_CC, E_WARNING,Empty needle);
RETURN_FALSE;
}
-   n = mbfl_strpos(haystack, needle, 0, 1);
+   n = mbfl_strpos(haystack, needle, offset, 1);
if (n = 0) {
RETVAL_LONG(n);
} else {

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php