Skip to content

Commit

Permalink
Fixed #4096
Browse files Browse the repository at this point in the history
Signed-off-by: brandonkelly <[email protected]>
  • Loading branch information
brandonkelly committed Apr 4, 2019
1 parent 38c1dbc commit 6f6fc9e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG-v3.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Release Notes for Craft CMS 3.x

## 3.1.21.1 - 2019-04-04

### Fixed
- Fixed a bug where underscores were getting stripped from element slugs. ([#4096](https://github.com/craftcms/cms/issues/4096))

## 3.1.21 - 2019-04-03

### Added
Expand Down
4 changes: 2 additions & 2 deletions src/helpers/StringHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
use Stringy\Stringy as BaseStringy;
use yii\base\Exception;
use yii\base\InvalidConfigException;
use yii\helpers\Inflector;

/**
* This helper class provides various multi-byte aware string related manipulation and encoding methods.
Expand Down Expand Up @@ -1071,7 +1070,8 @@ public static function replaceMb4(string $string, $replace): string
public static function toWords(string $string, bool $lower = false, bool $removePunctuation = false): array
{
// Convert CamelCase to multiple words
$string = Inflector::camel2words($string, false);
// Regex copied from Inflector::camel2words(), but without dropping punctuation
$string = preg_replace('/(?<!\p{Lu})(\p{Lu})|(\p{Lu})(?=\p{Ll})/u', ' \0', $string);

if ($lower) {
// Make it lowercase
Expand Down

0 comments on commit 6f6fc9e

Please sign in to comment.