ZF-9083: Zend_Ldap_Ldif_Encoder encode incorrecty "0" string value

Description

Here is a little patch to fix this LDIF encode bug : when exporting to LDIF a node with "0" as an attribute value, the result is a LDIF line with an empty attribute instead of a simple "0" string value.

To correct this problem, we just have to test if the value is numeric or not.

Here is the patch :


Index: Encoder.php
===================================================================
--- Encoder.php (révision 20905)
+++ Encoder.php (copie de travail)
@@ -181,7 +181,7 @@
     protected function _encodeString($string, &$base64 = null)
     {
         $string = (string)$string;
-        if (empty($string)) {
+        if (!is_numeric($string) && empty($string)) {
             return '';
         }

Comments

Fixed in trunk (r21005) and in 1.10-release branch (r21007)