Zend Framework

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

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.9.2
  • Fix Version/s: 1.9.3
  • Component/s: Zend_Ldap
  • Labels:
    None

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]);
...

Activity

Hide
Stefan Gehrig added a comment -

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

Show
Stefan Gehrig added a comment - Fixed in trunk r18249 and in 1.9-release branch (r18250).

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: