Issues

ZF-10668: Can't get input data

Issue Type: Bug Created: 2010-11-11T06:22:43.000+0000 Last Updated: 2012-11-20T21:37:36.000+0000 Status: Open Fix version(s): Reporter: Nicolas Renardet (xenesis) Assignee: None Tags: - Zend_Filter_Input

Related issues: Attachments:

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

Posted by Ralph Schindler (ralph) on 2010-11-11T07:27:42.000+0000

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

Posted by Nicolas Renardet (xenesis) on 2010-11-11T07:42:29.000+0000

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

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

Posted by Nicolas Renardet (xenesis) on 2010-11-11T07:45:26.000+0000

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

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