diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 471fcda..74fe91e 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -18,6 +18,7 @@ Yii Framework 2 Change Log - Bug #1631: Charset is now explicitly set to UTF-8 when serving JSON (samdark) - Bug #1635: `yii\jui\SliderInput` wasn't properly initialized (samdark) - Bug #1686: ActiveForm is creating duplicated messages in error summary (qiangxue) +- Bug #1704: Incorrect regexp is used in `Inflector::camelize()` (qiangxue) - Bug: Fixed `Call to a member function registerAssetFiles() on a non-object` in case of wrong `sourcePath` for an asset bundle (samdark) - Bug: Fixed incorrect event name for `yii\jui\Spinner` (samdark) - Bug: Json::encode() did not handle objects that implement JsonSerializable interface correctly (cebe) diff --git a/framework/yii/helpers/BaseInflector.php b/framework/yii/helpers/BaseInflector.php index cb59986..f9f19a8 100644 --- a/framework/yii/helpers/BaseInflector.php +++ b/framework/yii/helpers/BaseInflector.php @@ -341,7 +341,7 @@ class BaseInflector */ public static function camelize($word) { - return str_replace(' ', '', ucwords(preg_replace('/[^A-Z^a-z^0-9]+/', ' ', $word))); + return str_replace(' ', '', ucwords(preg_replace('/[^A-Za-z0-9]+/', ' ', $word))); } /** diff --git a/tests/unit/framework/helpers/InflectorTest.php b/tests/unit/framework/helpers/InflectorTest.php index e303ebd..ff414ba 100644 --- a/tests/unit/framework/helpers/InflectorTest.php +++ b/tests/unit/framework/helpers/InflectorTest.php @@ -73,6 +73,7 @@ class InflectorTest extends TestCase public function testCamelize() { $this->assertEquals("MeMySelfAndI", Inflector::camelize('me my_self-andI')); + $this->assertEquals("QweQweEwq", Inflector::camelize('qwe qwe^ewq')); } public function testUnderscore()