ZF-7888: Can't add/update value '0' becouse it will by filtered in Zend_Ldap::prepareLdapEntryArray


i want to update an entry with the value '0' but the function prepareLdapEntryArray delete the entry. Example:

$myEntry = array( 'required_field' => array('0'), 'objectclass' => 'oclass', );

$ldap->update('ou=my,ou=path,o=ldap', $entry);

this make an exception:

Zend_Ldap_Exception: 0x41 (Object class violation; object class 'oclass' requires attribute 'required_field'): updating: ou=my,ou=path,o=ldap

The reason for theat ist in the funktion prepareLdapEntryArray in Zend/Ldap.php Line 1041

... else if (empty($v)) unset($value[$i]); ...

for the function empty is a string with '0' empty. Perhaps is this a good solution:

... else if ($v === '') unset($value[$i]); ...


Fixed in trunk r18249 and in 1.9-release branch (r18250).