Issues

ZF-4097: Zend_Filter_Word_SeparatorToCamelCase incorrect match pattern

Issue Type: Bug Created: 2008-08-27T18:25:20.000+0000 Last Updated: 2009-06-25T11:57:39.000+0000 Status: Resolved Fix version(s): - 1.9.0 (31/Jul/09)

Reporter: Eugene Song (bakadesu) Assignee: Thomas Weidner (thomas) Tags: - Zend_Filter

Related issues: - ZF-6936

Attachments:

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".

<pre class="highlight">
$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

<pre class="highlight">
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')"));
}



<pre class="highlight">
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')"));
}

{color:green}[A-Z]{color} changed to {color:green}[a-z]{color} {color:green}strtoupper{color} changed to {color:green}strtolower{color}

Not sure if the match pattern for self::isUnicodeSupportEnabled (true) needs to be changed as well.

Comments

Posted by Ralph Schindler (ralph) on 2009-01-11T21:35:10.000+0000

Will address within 2 weeks

Posted by Thomas Weidner (thomas) on 2009-06-20T12:22:45.000+0000

Fixed with r16188

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts