nlopess         Fri Apr 10 15:48:22 2009 UTC

  Modified files:              
    /php-src/ext/pcre   php_pcre.c 
    /php-src/ext/pcre/tests     bug47662.phpt 
  Log:
  MFB: fix #47662
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pcre/php_pcre.c?r1=1.250&r2=1.251&diff_format=u
Index: php-src/ext/pcre/php_pcre.c
diff -u php-src/ext/pcre/php_pcre.c:1.250 php-src/ext/pcre/php_pcre.c:1.251
--- php-src/ext/pcre/php_pcre.c:1.250   Mon Mar 30 14:21:03 2009
+++ php-src/ext/pcre/php_pcre.c Fri Apr 10 15:48:22 2009
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_pcre.c,v 1.250 2009/03/30 14:21:03 kalle Exp $ */
+/* $Id: php_pcre.c,v 1.251 2009/04/10 15:48:22 nlopess Exp $ */
 
 /*  TODO
  *  php_pcre_replace_impl():
@@ -220,7 +220,7 @@
                }
 
                while (ni++ < name_cnt) {
-                       name_idx = 0xff * name_table[0] + name_table[1];
+                       name_idx = 0xff * (unsigned char)name_table[0] + 
(unsigned char)name_table[1];
                        subpat_names[name_idx] = name_table + 2;
                        if (is_numeric_string(subpat_names[name_idx], 
strlen(subpat_names[name_idx]), NULL, NULL, 0) > 0) {
                                php_error_docref(NULL TSRMLS_CC, E_WARNING, 
"Numeric named subpatterns are not allowed");
http://cvs.php.net/viewvc.cgi/php-src/ext/pcre/tests/bug47662.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/pcre/tests/bug47662.phpt
diff -u /dev/null php-src/ext/pcre/tests/bug47662.phpt:1.2
--- /dev/null   Fri Apr 10 15:48:22 2009
+++ php-src/ext/pcre/tests/bug47662.phpt        Fri Apr 10 15:48:22 2009
@@ -0,0 +1,18 @@
+--TEST--
+Bug #47662 (support more than 127 named subpatterns)
+--FILE--
+<?php
+
+$regex = '@';
+for($bar=0; $bar<1027; $bar++) {
+       $regex .= '((?P<x'.$bar.'>))';
+}
+$regex .= 'fo+bar@';
+
+var_dump(preg_match($regex, 'foobar'));
+echo "Done!\n";
+
+?>
+--EXPECT--
+int(1)
+Done!



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

Reply via email to