Skip to content

Commit

Permalink
Merge branch '4.x' of https://github.com/craftcms/cms into 5.x
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGELOG.md
  • Loading branch information
brandonkelly committed Sep 22, 2024
2 parents 8d7e7fc + 979e992 commit 7a4c5f7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- Auto-generated handles, slugs, etc. now update immediately when the source input is changed. ([#15754](https://github.com/craftcms/cms/issues/15754))
- Fixed a bug where Table fields’ Default Values table could lose existing rows if they only consisted of Dropdown columns without configured options.
- Fixed a bug where custom fields’ `required` properties were always `false`. ([#15752](https://github.com/craftcms/cms/issues/15752))
- Fixed a bug where `craft\helpers\StringHelper::toHandle()` was allowing non-alphanumeric/underscore characters through. ([#15772](https://github.com/craftcms/cms/pull/15772))
- Fixed a bug where it wasn’t possible to save nested entries via the `entries/save-entry` controller action. ([#15737](https://github.com/craftcms/cms/issues/15737))
- Fixed a bug where hyperlinks in Link field inputs could wrap unnecessarily. ([#15738](https://github.com/craftcms/cms/issues/15738))
- Fixed an error that occurred when running the `entrify/global-set` command. ([#15746](https://github.com/craftcms/cms/issues/15746))
Expand Down
3 changes: 3 additions & 0 deletions src/helpers/StringHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -1816,6 +1816,9 @@ public static function toHandle(string $str): string
// Handle must start with a letter
$handle = preg_replace('/^[^a-z]+/', '', $handle);

// Replace any remaining non-alphanumeric or underscore characters with spaces
$handle = preg_replace('/[^a-z0-9_]/', ' ', $handle);

return static::toCamelCase($handle);
}

Expand Down
4 changes: 4 additions & 0 deletions tests/unit/helpers/StringHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2208,6 +2208,10 @@ public static function toHandleDataProvider(): array
['fooBar', 'Fo’o Bar'],
['fooBarBaz', 'Foo Ba’r Baz'],
['fooBar', '0 Foo Bar'],
['fooBar', 'Foo!Bar'],
['fooBar', 'Foo,Bar'],
['fooBar', 'Foo/Bar'],
['fooBar', 'Foo\\Bar'],
];
}

Expand Down

0 comments on commit 7a4c5f7

Please sign in to comment.