Skip to content

Commit

Permalink
Fix incorrect regex in Text::slug().
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Oct 5, 2017
1 parent 86eefd1 commit f9d6473
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Utility/Text.php
Expand Up @@ -1108,7 +1108,7 @@ public static function slug($string, $options = [])

$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 = [
Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase/Utility/TextTest.php
Expand Up @@ -1810,8 +1810,8 @@ public function slugInputProvider()
'cl-ean-me'
],
[
'cl#ean(me.jpg', ['preserve' => '.'],
'cl-ean-me.jpg'
'cl#e|an(me.jpg', ['preserve' => '.'],
'cl-e-an-me.jpg'
],
];
}
Expand Down

0 comments on commit f9d6473

Please sign in to comment.