ZF-10668: Can't get input data

Description

I'm using Zend_Filter_Input to pass data to it and get escaped value of fields.

I notice if you want create a email Rule using Zend_Validate_emailAdress

    $emailValidator = new Zend_Validate_EmailAddress(array('allow'=>Zend_Validate_Hostname::ALLOW_DNS,'mx'=>true));

Like this,

the $input->getEscaped(); give me empty value If i remove the mx parameter to false it's give me the mail value (eg : ffff@tesfsdfsinsf.com)

There is maybe a problem with return function ?

Comments

Can you please supply a reproduction script that includes the bit of code that shows how you are attempting to utilize Zend_FIlter_Input? The above information is not enough to understand the problem you are attempting to describe.

Thanks! Ralph


class Extras_Filter_Input extends Zend_Filter_Input
{
    
    public function __construct($data) 
    {

        $options = array('filterNamespace' => 'Extras_Filter','validatorNamespace' => 'Extras_Validate',
        'missingMessage'=>"Le champs '%field%' est obligatoire");
        
        $filters = array(
                    '*'=> array(array('StringTrim'),array('StripSlashes'),array('StringToLower',array('encoding'=>'UTF-8')))
        );
        
        $validators = array(
            'loginF' => array(
                'NotEmpty',
                 array('Alnum'),
                 new Zend_Validate_Regex('/^[a-zA-Z]/'),
                        'messages' => array(
                            "Login requis!",
                            "Le login ne peut comporter que des numéros et/ou des chiffres",
                            "Le login doit commencer par une lettre"
                        )
            ),
                        
            'emailF'  => array(
                'NotEmpty',
                array('EmailAddress',array('allow'=>Zend_Validate_Hostname::ALLOW_DNS,'mx'=>false)),
                    'messages'=> array("Veuillez renseigner votre adresse Email"                        )
                    )
                ),
                '*' => array()
            );
        
        parent::__construct($filters,$validators,$data,$options);
    }

And in my controller i have write this :


$_POST['emailF']='wrong@@value.fr';
$input = new Extras_Filter_Input($_POST);

$input->getEscaped('emailF') return nothing if i let MX = true in the validator

I add (following the official ZF doc) a empty validator to get the value (by using array_merge on $input->getUnknown()), so at the end of $validator i wrote this :

'*' => array()

I can get the input field by this way but if i encounter error like empty for this validator message, getErrors() present me the emailF error msg (empty value) and '*' empty value too.

I precise :

$input->getEscaped('emailF') return nothing if i let MX = true in the EmailAdress validator constructor else if i let mx to false, i get the value : 'wrong@@value.fr' that i expected