mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-02 04:37:42 +08:00
@ -7,6 +7,7 @@ Yii Framework 2 Change Log
|
||||
|
||||
- Enh #18826: Add ability to turn the sorting off for a clicked column in GridView with multisort (ditibal)
|
||||
- Bug #18646: Remove stale identity data from session if `IdentityInterface::findIdentity()` returns `null` (mikehaertl)
|
||||
- Bug #18832: Fix `Inflector::camel2words()` adding extra spaces (brandonkelly)
|
||||
|
||||
|
||||
2.0.43 August 09, 2021
|
||||
|
||||
@ -371,11 +371,11 @@ class BaseInflector
|
||||
*/
|
||||
public static function camel2words($name, $ucwords = true)
|
||||
{
|
||||
$label = mb_strtolower(trim(str_replace([
|
||||
'-',
|
||||
'_',
|
||||
'.',
|
||||
], ' ', preg_replace('/(?<!\p{Lu})(\p{Lu})|(\p{Lu})(?=\p{Ll})/u', ' \0', $name))), self::encoding());
|
||||
// Add a space before any uppercase letter preceded by a lowercase letter (xY => x Y)
|
||||
// and any uppercase letter preceded by an uppercase letter and followed by a lowercase letter (XYz => X Yz)
|
||||
$label = preg_replace('/(?<=\p{Ll})\p{Lu}|(?<=\p{L})\p{Lu}(?=\p{Ll})/u', ' \0', $name);
|
||||
|
||||
$label = mb_strtolower(trim(str_replace(['-', '_', '.'], ' ', $label)), self::encoding());
|
||||
|
||||
return $ucwords ? StringHelper::mb_ucwords($label, self::encoding()) : $label;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user