Browse Source

Merge pull request #11275 from cakephp/fix-slug-regex

Fix incorrect regex in Text::slug().
Mark Story 8 years ago
parent
commit
42f8054a13
2 changed files with 3 additions and 3 deletions
  1. 1 1
      src/Utility/Text.php
  2. 2 2
      tests/TestCase/Utility/TextTest.php

+ 1 - 1
src/Utility/Text.php

@@ -1108,7 +1108,7 @@ class Text
 
         $regex = '^\s\p{Ll}\p{Lm}\p{Lo}\p{Lt}\p{Lu}\p{Nd}';
         if ($options['preserve']) {
-            $regex .= '|' . preg_quote($options['preserve'], '/');
+            $regex .= preg_quote($options['preserve'], '/');
         }
         $quotedReplacement = preg_quote($options['replacement'], '/');
         $map = [

+ 2 - 2
tests/TestCase/Utility/TextTest.php

@@ -1810,8 +1810,8 @@ HTML;
                 'cl-ean-me'
             ],
             [
-                'cl#ean(me.jpg', ['preserve' => '.'],
-                'cl-ean-me.jpg'
+                'cl#e|an(me.jpg', ['preserve' => '.'],
+                'cl-e-an-me.jpg'
             ],
         ];
     }