moriyoshi               Thu Oct  2 04:01:15 2003 EDT

  Added files:                 (Branch: PHP_4_3)
    /php-src/ext/mbstring/tests php_gr_jp_dev_884-1.phpt 
                                php_gr_jp_dev_884-2.phpt 

  Modified files:              
    /php-src/ext/mbstring       mbregex.c 
  Log:
  Fix for a regex bug that leads into an infinite loop due to optimization
  failure when the pattern is ".*" and both MULTILINE and SINGLELINE options are
  specified.
  # This bug was already squashed in HEAD, as it adopts an alternative
  # implementation.
  
  
Index: php-src/ext/mbstring/mbregex.c
diff -u php-src/ext/mbstring/mbregex.c:1.16.2.1 php-src/ext/mbstring/mbregex.c:1.16.2.2
--- php-src/ext/mbstring/mbregex.c:1.16.2.1     Tue Aug  5 16:54:43 2003
+++ php-src/ext/mbstring/mbregex.c      Thu Oct  2 04:01:11 2003
@@ -3326,7 +3326,7 @@
     }
   }
   if (bufp->options & MBRE_OPTIMIZE_ANCHOR) {
-    if (bufp->options&MBRE_OPTION_SINGLELINE) {
+    if (bufp->options&MBRE_OPTION_MULTILINE & range > 0) {
       goto begbuf_match;
     }
     anchor = 1;

Index: php-src/ext/mbstring/tests/php_gr_jp_dev_884-1.phpt
+++ php-src/ext/mbstring/tests/php_gr_jp_dev_884-1.phpt
--TEST--
[EMAIL PROTECTED] #884 (1)
--FILE--
<?php
set_time_limit(2);
var_dump(ereg_replace(".*", "b", "a"));
var_dump(preg_replace("/.*/", "b", "a"));
var_dump(mb_ereg_replace(".*", "b", "a"));
?>
--EXPECT--
string(2) "bb"
string(2) "bb"
string(2) "bb"

Index: php-src/ext/mbstring/tests/php_gr_jp_dev_884-2.phpt
+++ php-src/ext/mbstring/tests/php_gr_jp_dev_884-2.phpt
--TEST--
[EMAIL PROTECTED] #884 (2)
--FILE--
<?php
var_dump(mb_ereg_replace("C?$", "Z", "ABC"));
var_dump(ereg_replace("C?$", "Z", "ABC"));
var_dump(mb_ereg_replace("C*$", "Z", "ABC"));
var_dump(ereg_replace("C*$", "Z", "ABC"));
?>
--EXPECT--
string(4) "ABZZ"
string(4) "ABZZ"
string(4) "ABZZ"
string(4) "ABZZ"

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

Reply via email to