Skip to content

Commit 9c4c36e

Browse files
authored
Fix #19467: Revert changes in Inflector::camel2words() (#19495)
* Fix #19467: Revert changes in `Inflector::camel2words()` introduced in #19204 * Add UPGRADE note
1 parent 59f69fc commit 9c4c36e

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

framework/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Yii Framework 2 Change Log
44
2.0.46 under development
55
------------------------
66

7+
- Bug #19467: Revert changes in `Inflector::camel2words()` introduced in #19204 (samdark)
78
- Bug #19471: Enable console commands on hostings with disabled `exec()` function (WinterSilence, lubosdz)
89
- Bug #19469: Fix a virtual relation not working because of new isset checks in `\yii\db\ActiveRelationTrait` (wvanheumen)
910
- Bug #19380: Fix PHP 8.1 passing non string to trim() in `yii\db\Query` (wa1kb0y)

framework/UPGRADE.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ if you want to upgrade from version A to version C and there is
5151
version B between A and C, you need to follow the instructions
5252
for both A and B.
5353

54+
Upgrade from Yii 2.0.45
55+
-----------------------
56+
57+
* Changes in `Inflector::camel2words()` introduced in 2.0.45 were reverted so it works as in pre-2.0.45. If you need
58+
2.0.45 behavior, [introduce your own method](https://github.com/yiisoft/yii2/pull/19495/files).
59+
5460
Upgrade from Yii 2.0.44
5561
-----------------------
5662

framework/helpers/BaseInflector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ public static function camel2words($name, $ucwords = true)
388388
}
389389
// Add a space before any uppercase letter preceded by a lowercase letter (xY => x Y)
390390
// and any uppercase letter preceded by an uppercase letter and followed by a lowercase letter (XYz => X Yz)
391-
$label = preg_replace('/(?<=\p{Ll})\p{Lu}|(?<=[\p{L}\d])\p{Lu}(?=\p{Ll})|(\d+)/u', ' \0', $name);
391+
$label = preg_replace('/(?<=\p{Ll})\p{Lu}|(?<=\p{L})\p{Lu}(?=\p{Ll})/u', ' \0', $name);
392392

393393
$label = mb_strtolower(trim(str_replace(['-', '_', '.'], ' ', $label)), self::encoding());
394394

tests/framework/helpers/InflectorTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,6 @@ public function testCamel2words()
121121
$this->assertEquals('Foo Bar', Inflector::camel2words('foo BAR'));
122122
$this->assertEquals('Foo Bar', Inflector::camel2words('Foo Bar'));
123123
$this->assertEquals('Foo Bar', Inflector::camel2words('FOO BAR'));
124-
$this->assertEquals('Order 4 Other Phones', Inflector::camel2words('Order4OtherPhones'));
125-
$this->assertEquals('I Have 23 Dogs', Inflector::camel2words('IHave23Dogs'));
126-
$this->assertEquals('Con Chó Cười 34 Lần', Inflector::camel2words('ConChóCười34Lần'));
127124
}
128125

129126
public function testCamel2id()

0 commit comments

Comments
 (0)