Commit 0b28f290 by Qiang Xue

Fixes #1704: Incorrect regexp is used in `Inflector::camelize()`

parent 1361bd3c
......@@ -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)
......
......@@ -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)));
}
/**
......
......@@ -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()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment