[bugs] [Bug 1285] Changed - Carriage Return Line Feed supposed to be only line feed in multiline entries in LDAP

bugs at bugs.horde.org bugs at bugs.horde.org
Tue Jun 17 12:46:13 PDT 2003


http://bugs.horde.org/show_bug.cgi?id=1285

*** shadow/1285	Tue Jun 17 16:45:17 2003
--- shadow/1285.tmp.18285	Tue Jun 17 16:46:13 2003
***************
*** 58,60 ****
--- 58,122 ----
           }
   
  
+ 
+ ------- Additional Comments From urkle at drip.ws  06/17/03 16:46 -------
+ Turba 1.2 patch
+ --- ldap.php.orig	Tue Feb 25 20:40:48 2003
+ +++ ldap.php	Sun Jun 15 23:54:34 2003
+ @@ -301,14 +301,17 @@
+          // Don't add empty attributes.
+          $attributes = array_filter($attributes, array($this,
+ 'cleanEmptyAttributes'));
+  
+ -        // Encode entries in UTF-8 if requested.
+ -        if ($this->encoding == 'utf8') {
+ -            foreach ($attributes as $key => $val) {
+ -                if (!is_array($val)) {
+ -                    $attributes[$key] = utf8_encode($val);
+ -                }
+ -            }
+ -        }
+ +	// fix CRLF to LF in multiline entries
+ +	foreach ($attributes as $key => $val) {
+ +            if (!is_array($val)) {
+ +		$val = str_replace("\r\n","\n",$val);
+ +    		// Encode entries in UTF-8 if requested.
+ +		if ($this->encoding == 'utf8') {
+ +            	    $val = utf8_encode($val);
+ +    		}
+ +		$attributes[$key] = $val;
+ +	    }
+ +	}
+  
+          if (!@ldap_add($this->ds, $dn, $attributes)) {
+              return new PEAR_Error('Failed to add an object: [' .
+ ldap_errno($this->ds) . '] "' . ldap_error($this->ds) . '" (attributes: [' .
+ serialize($attributes) . ']).');
+ @@ -375,14 +378,17 @@
+              }
+          }
+  
+ -        // Encode entries in UTF-8 if requested.
+ -        if ($this->encoding == 'utf8') {
+ -            foreach ($attributes as $key => $val) {
+ -                if (!is_array($val)) {
+ -                    $attributes[$key] = utf8_encode($val);
+ -                }
+ -            }
+ -        }
+ +	// fix CRLF to LF in multiline entries
+ +	foreach ($attributes as $key => $val) {
+ +            if (!is_array($val)) {
+ +		$val = str_replace("\r\n","\n",$val);
+ +    		// Encode entries in UTF-8 if requested.
+ +		if ($this->encoding == 'utf8') {
+ +            	    $val = utf8_encode($val);
+ +    		}
+ +		$attributes[$key] = $val;
+ +	    }
+ +	}
+  
+          unset($attributes[$object_key]);
+          $attributes = array_filter($attributes, array($this,
+ 'cleanEmptyAttributes'));
+ 


More information about the bugs mailing list