Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.6.0RC2, 1.6.0RC3
-
Fix Version/s: 1.9.0
-
Component/s: Zend_Filter
-
Labels:None
Description
Not sure if Zend_Filter_Word_SeparatorToCamelCase is what I should be using, but my intention was to filter the string "zend_framework" to "zendFramework".
$obj = new Zend_Filter(); $obj->addFilter(new Zend_Filter_Word_UnderscoreToCamelCase('_')); echo $obj->filter("zend_framework"); // Prints "Zend_framework" echo $obj->filter("zend_Framework"); // Prints "ZendFramework" echo $obj->filter("zendFramework"); // Prints "ZendFramework" echo $obj->filter("zendframework"); // Prints "Zendframework" echo $obj->filter("_zendframework"); // Prints "_zendframework" echo $obj->filter("_zend_framework"); // Prints "_zend_framework"
Zend_Filter_Word_SeparatorToCamelCase
Original
if (self::isUnicodeSupportEnabled()) { parent::setMatchPattern(array('#('.$pregQuotedSeparator.')(\p{L}{1})#e','#(^\p{Ll}{1})#e')); parent::setReplacement(array("strtoupper('\\2')","strtoupper('\\1')")); } else { parent::setMatchPattern(array('#('.$pregQuotedSeparator.')([A-Z]{1})#e','#(^[a-z]{1})#e')); parent::setReplacement(array("strtoupper('\\2')","strtoupper('\\1')")); }
Suggestion
if (self::isUnicodeSupportEnabled()) { parent::setMatchPattern(array('#('.$pregQuotedSeparator.')(\p{L}{1})#e','#(^\p{Ll}{1})#e')); parent::setReplacement(array("strtoupper('\\2')","strtolower('\\1')")); } else { parent::setMatchPattern(array('#('.$pregQuotedSeparator.')([a-z]{1})#e','#(^[a-z]{1})#e')); parent::setReplacement(array("strtoupper('\\2')","strtolower('\\1')")); }
[A-Z] changed to [a-z]
strtoupper changed to strtolower
Not sure if the match pattern for self::isUnicodeSupportEnabled (true) needs to be changed as well.
Issue Links
| This issue is duplicated by: | ||||
| ZF-6936 | Zend Filter unit tests fail when Unicode disabled |
|
|
|
Will address within 2 weeks