Issues

ZF-12057: Zend_Validate_Ldap_Dn

Issue Type: Improvement Created: 2012-02-13T17:56:53.000+0000 Last Updated: 2012-06-13T21:27:32.000+0000 Status: Resolved Fix version(s): Reporter: Anderson Luiz Silvério (anderson.ls) Assignee: Christian Albrecht (alab) Tags: - Zend_Form

  • Zend_Validate
  • FixForZF1.12

Related issues: Attachments:

Description

I'm using a Zend_Form to configure an LDAP server and i noticed that Zend does not provide any validator for DN, so i created a simple validator that uses the Zend_Ldap_Dn::checkDn method. Here's what i got:

<pre class="highlight">
class Zend_Validate_Ldap_Dn extends Zend_Validate_Abstract
{

    const MALFORMED = 'malformed';
    
    /**
     * Validation failure message template definitions.
     *
     * @var array
     */
    protected $_messageTemplates = array(
        self::MALFORMED => 'DN is malformed',
    );
    
    /**
     * Defined by Zend_Validate_Interface.
     *
     * Returns true if and only if $value is a valid DN.
     *
     * @param string $value The value to be validated.
     * 
     * @return boolean
     */
    public function isValid($value) 
    {
        $valid = Zend_Ldap_Dn::checkDn($value);
        if ($valid === false) {
            $this->_error(self::MALFORMED);
            return false;
        }
        return true;
    }
}

Comments

Posted by Rob Allen (rob) on 2012-06-13T21:27:32.000+0000

Fixed in svn r24956

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