Browse Source

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

tags/2.0.0-beta
Qiang Xue 11 years ago
parent
commit
0b28f290f3
  1. 1
      framework/CHANGELOG.md
  2. 2
      framework/yii/helpers/BaseInflector.php
  3. 1
      tests/unit/framework/helpers/InflectorTest.php

1
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)

2
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)));
}
/**

1
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()

Loading…
Cancel
Save