ZF-7888: Can't add/update value '0' becouse it will by filtered in Zend_Ldap::prepareLdapEntryArray
Description
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]); ...
Comments
Posted by Stefan Gehrig (sgehrig) on 2009-09-18T08:54:13.000+0000
Fixed in trunk r18249 and in 1.9-release branch (r18250).