xref: /PHP-7.3/ext/pcre/tests/bug41148.phpt (revision 17db5db7)
1--TEST--
2Bug #41148 (pcre 7.0 regression)
3--FILE--
4<?php
5
6    $letexte="<br><br>";
7    $ligne_horizontale = $puce = $debut_intertitre = $fin_intertitre = '';
8
9    $cherche1 = array(
10        /* 0 */     "/\n(----+|____+)/S",
11        /* 1 */     "/\n-- */S",
12        /* 2 */     "/\n- */S",
13        /* 3 */     "/\n_ +/S",
14        /* 4 */   "/(^|[^{])[{][{][{]/S",
15        /* 5 */   "/[}][}][}]($|[^}])/S",
16        /* 6 */     "/(( *)\n){2,}(<br[[:space:]]*\/?".">)?/S",
17        /* 7 */     "/[{][{]/S",
18        /* 8 */     "/[}][}]/S",
19        /* 9 */     "/[{]/S",
20        /* 10 */    "/[}]/S",
21        /* 11 */    "/(<br[[:space:]]*\/?".">){2,}/S",
22        /* 12 */    "/<p>([\n]*(<br[[:space:]]*\/?".">)*)*/S",
23        /* 13 */    "/<quote>/S",
24        /* 14 */    "/<\/quote>/S"
25    );
26    $remplace1 = array(
27        /* 0 */     "\n\n$ligne_horizontale\n\n",
28        /* 1 */     "\n<br />&mdash;&nbsp;",
29        /* 2 */     "\n<br />$puce&nbsp;",
30        /* 3 */     "\n<br />",
31        /* 4 */     "\$1\n\n$debut_intertitre",
32        /* 5 */     "$fin_intertitre\n\n\$1",
33        /* 6 */     "<p>",
34        /* 7 */     "<strong class=\"spip\">",
35        /* 8 */     "</strong>",
36        /* 9 */     "<i class=\"spip\">",
37        /* 10 */    "</i>",
38        /* 11 */    "<p>",
39        /* 12 */    "<p>",
40        /* 13 */    "<blockquote class=\"spip\"><p>",
41        /* 14 */    "</blockquote><p>"
42    );
43    $letexte = preg_replace($cherche1, $remplace1, $letexte);
44    $letexte = preg_replace("@^ <br />@S", "", $letexte);
45
46    print $letexte;
47
48?>
49--EXPECT--
50<p>
51