diff --git a/CHANGELOG-v3.md b/CHANGELOG-v3.md index 25b069c3056..16204b76a89 100644 --- a/CHANGELOG-v3.md +++ b/CHANGELOG-v3.md @@ -4,6 +4,7 @@ ### Fixed - Fixed a bug where the `orderBy` element query param wasn’t being respected when used in conjunction with a `with` param to eager-load elements in a specific order. ([#3109](https://github.com/craftcms/cms/issues/3109)) +- Fixed a bug where underscores were getting removed from slugs. ([#3111](https://github.com/craftcms/cms/issues/3111)) ## 3.0.16 - 2018-07-17 diff --git a/src/helpers/StringHelper.php b/src/helpers/StringHelper.php index 943696c9ef3..bb2d958be31 100644 --- a/src/helpers/StringHelper.php +++ b/src/helpers/StringHelper.php @@ -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. @@ -1039,9 +1038,12 @@ public static function encodeMb4(string $string): string */ private static function _prepStringForCasing(string $string, bool $lower = true, bool $removePunctuation = true): array { + // Convert CamelCase to multiple words + $string = preg_replace('/(?