Yii2: Inflector::camelize unexpected behaviour after recent upgrade

Created on 7 May 2018  路  5Comments  路  Source: yiisoft/yii2

What steps will reproduce the problem?

A bit of an edge case, but I was passing strings to the camelize function that may or may not already been in camelized format. This changed with the latest update here 629a33fd0e2f469eef29de7d30f0f23c66e5791f. To reproduce:

echo \yii\helpers\Inflector::camelize('HelloWorld');

What is the expected result?

HelloWorld

What do you get instead?

Helloworld

Additional info

See commit 629a33fd0e2f469eef29de7d30f0f23c66e5791f

BC breaking bug

All 5 comments

I think that current behavior is correct. Uppercase letters should indicate word separators and everything else should be lowercased. If you pass string without word separators, only first letter should be uppercased.

It makes perfect sense, but it's still a BC braking change.

Should we add it to an UPGRADE.md (馃憤), fix it to keep BC (馃槙) or rollback it and move the entire change to 2.1 (鉂わ笍)

By reverting this you're introducing another BC break :/.

Also: https://xkcd.com/1172/ ;).

By reverting this you're introducing another BC break :/.

No. It wasn't released yet.

I'd either make it compatible or move to 2.1.

Was this page helpful?
0 / 5 - 0 ratings