Issues

ZF-11716: Problem with filter stringTrim and accented character à

Issue Type: Bug Created: 2011-09-02T09:24:25.000+0000 Last Updated: 2011-09-25T09:05:26.000+0000 Status: Resolved Fix version(s): - Next Major Release ()

Reporter: alessio bigagnoli (alessio_lab4it) Assignee: Thomas Weidner (thomas) Tags: - Zend_Filter

Related issues: - ZF-11752

Attachments:

Description

If you use String Trim filter in zend_form_element_text and the last char is the special char "à" the validation StringLength return this message:

Notice: iconv_strlen() [function.iconv-strlen]: Detected an incomplete multibyte character in input string in C:\Programmi\Zend\ZendServer\share\ZendFramework\library\Zend\Validate\StringLength.php on line 234

this is the code to reproduce the error:

<pre class="highlight">
class Application_Form_Form extends Zend_Form
{
    public function init()
    {
    $this->setAttrib('accept-charset', 'UTF-8');        
        $this->setName("form");
        $this->setMethod('post');
             
        $this->addElement('text', 'field', array(
            'filters'    => array('StringTrim'),
            'validators' => array(
                array('StringLength', false, array(2, 50,'encoding' => 'UTF-8')),
            ),
            'required'   => true,
            'label'      => 'field',
        ));     
        $this->addElement('submit', 'submit', array(
            'required' => false,
            'ignore'   => true,
            'label'    => 'submit',
        )); 
    }
}



<pre class="highlight">
class IndexController extends Zend_Controller_Action
{

    public function init()
    {
        /* Initialize action controller here */
    }

    public function indexAction()
    {
        $form = new Application_Form_Form();
        $request=$this->getRequest();
        if($request->isPost()){
            if($form->isValid($request->getPost())){
            }
        }

        $this->view->form=$form;
    }
}



<pre class="highlight">

<?php 
echo $this->form;
?>

Comments

Posted by Kim Blomqvist (kblomqvist) on 2011-09-03T06:19:24.000+0000

Code tags added

Posted by Thomas Weidner (thomas) on 2011-09-03T07:03:57.000+0000

The heading says that StringTrim has problems, but the example error message you gave says that StringLength has the problem. Can you please verify which of the two filters makes problem in your environment and fix heading or example?

Posted by Thomas Weidner (thomas) on 2011-09-03T20:36:19.000+0000

Closing as duplicate of ZF-11551

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