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

Issue Type: Patch Created: 2010-02-04T08:58:25.000+0000 Last Updated: 2010-02-09T05:40:33.000+0000 Status: Resolved Fix version(s): - 1.10.1 (10/Feb/10)

Reporter: Stéphane Gully (kerphi) Assignee: Stefan Gehrig (sgehrig) Tags: - Zend_Ldap

Related issues: Attachments:


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 :

<pre class="highlight">
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 '';


Posted by Stefan Gehrig (sgehrig) on 2010-02-09T05:40:32.000+0000

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

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.