nlopess         Fri Jun 15 12:04:26 2007 UTC

  Modified files:              
    /php-src/ext/pcre/tests     bug41050.phpt bug41148.phpt bug41638.phpt 
  Log:
  MFB: new tests
  #they pass here, but segfault on php 5.2/pcre 7.0
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pcre/tests/bug41050.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/pcre/tests/bug41050.phpt
diff -u /dev/null php-src/ext/pcre/tests/bug41050.phpt:1.2
--- /dev/null   Fri Jun 15 12:04:26 2007
+++ php-src/ext/pcre/tests/bug41050.phpt        Fri Jun 15 12:04:26 2007
@@ -0,0 +1,26 @@
+--TEST--
+Bug #41050 (pcre 7.0 regression)
+--FILE--
+<?php
+// by legolas558
+
+$regex = 
'/(insert|drop|create|select|delete|update)([^;\']*('."('[^']*')+".')?)*(;|$)/i';
+
+$sql = 'SELECT * FROM #__components';
+
+if (preg_match($regex,$sql, $m)) echo 'matched';
+else echo 'not matched';
+
+print_r($m);
+
+?>
+--EXPECT--
+matchedArray
+(
+    [0] => SELECT * FROM #__components
+    [1] => SELECT
+    [2] => 
+    [3] => 
+    [4] => 
+    [5] => 
+)
http://cvs.php.net/viewvc.cgi/php-src/ext/pcre/tests/bug41148.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/pcre/tests/bug41148.phpt
diff -u /dev/null php-src/ext/pcre/tests/bug41148.phpt:1.2
--- /dev/null   Fri Jun 15 12:04:26 2007
+++ php-src/ext/pcre/tests/bug41148.phpt        Fri Jun 15 12:04:26 2007
@@ -0,0 +1,50 @@
+--TEST--
+Bug #41148 (pcre 7.0 regression)
+--FILE--
+<?php
+
+    $letexte="<br><br>";
+    $ligne_horizontale = $puce = $debut_intertitre = $fin_intertitre = '';
+
+    $cherche1 = array(
+        /* 0 */     "/\n(----+|____+)/S",
+        /* 1 */     "/\n-- */S",
+        /* 2 */     "/\n- */S",
+        /* 3 */     "/\n_ +/S",
+        /* 4 */   "/(^|[^{])[{][{][{]/S",
+        /* 5 */   "/[}][}][}]($|[^}])/S",
+        /* 6 */     "/(( *)\n){2,}(<br[[:space:]]*\/?".">)?/S",
+        /* 7 */     "/[{][{]/S",
+        /* 8 */     "/[}][}]/S",
+        /* 9 */     "/[{]/S",
+        /* 10 */    "/[}]/S",
+        /* 11 */    "/(<br[[:space:]]*\/?".">){2,}/S",
+        /* 12 */    "/<p>([\n]*(<br[[:space:]]*\/?".">)*)*/S",
+        /* 13 */    "/<quote>/S",
+        /* 14 */    "/<\/quote>/S"
+    );
+    $remplace1 = array(
+        /* 0 */     "\n\n$ligne_horizontale\n\n",
+        /* 1 */     "\n<br />&mdash;&nbsp;",
+        /* 2 */     "\n<br />$puce&nbsp;",
+        /* 3 */     "\n<br />",
+        /* 4 */     "\$1\n\n$debut_intertitre",
+        /* 5 */     "$fin_intertitre\n\n\$1",
+        /* 6 */     "<p>",
+        /* 7 */     "<strong class=\"spip\">",
+        /* 8 */     "</strong>",
+        /* 9 */     "<i class=\"spip\">",
+        /* 10 */    "</i>",
+        /* 11 */    "<p>",
+        /* 12 */    "<p>",
+        /* 13 */    "<blockquote class=\"spip\"><p>",
+        /* 14 */    "</blockquote><p>"
+    );
+    $letexte = preg_replace($cherche1, $remplace1, $letexte);
+    $letexte = preg_replace("@^ <br />@S", "", $letexte);
+
+    print $letexte;
+
+?>
+--EXPECT--
+<p>
http://cvs.php.net/viewvc.cgi/php-src/ext/pcre/tests/bug41638.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/pcre/tests/bug41638.phpt
diff -u /dev/null php-src/ext/pcre/tests/bug41638.phpt:1.2
--- /dev/null   Fri Jun 15 12:04:26 2007
+++ php-src/ext/pcre/tests/bug41638.phpt        Fri Jun 15 12:04:26 2007
@@ -0,0 +1,82 @@
+--TEST--
+Bug #41638 (pcre 7.0 regression)
+--FILE--
+<?php
+$str = "repeater id='loopt' dataSrc=subject colums=2";
+
+preg_match_all("/(['\"])((.*(\\\\\\1)*)*)\\1/sU",$str,$str_instead);
+print_r($str_instead);
+
+// these two are from Magnus Holmgren (extracted from a pcre-dev mailing list 
post)
+preg_match_all("/(['\"])((?:\\\\\\1|.)*)\\1/sU", $str, $str_instead);
+print_r($str_instead);
+
+preg_match_all("/(['\"])(.*)(?<!\\\\)\\1/sU", $str, $str_instead);
+print_r($str_instead);
+
+?>
+--EXPECT--
+Array
+(
+    [0] => Array
+        (
+            [0] => 'loopt'
+        )
+
+    [1] => Array
+        (
+            [0] => '
+        )
+
+    [2] => Array
+        (
+            [0] => loopt
+        )
+
+    [3] => Array
+        (
+            [0] => t
+        )
+
+    [4] => Array
+        (
+            [0] => 
+        )
+
+)
+Array
+(
+    [0] => Array
+        (
+            [0] => 'loopt'
+        )
+
+    [1] => Array
+        (
+            [0] => '
+        )
+
+    [2] => Array
+        (
+            [0] => loopt
+        )
+
+)
+Array
+(
+    [0] => Array
+        (
+            [0] => 'loopt'
+        )
+
+    [1] => Array
+        (
+            [0] => '
+        )
+
+    [2] => Array
+        (
+            [0] => loopt
+        )
+
+)

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

Reply via email to