[#5979] (whitespace-)trimming of mapped attributes
Summary (whitespace-)trimming of mapped attributes
Queue Turba
Queue Version 2.2-RC1
Type Enhancement
State Resolved
Priority 1. Low
Owners Jan Schneider <jan (at) horde (dot) org>
Requester xk3 (at) mompl (dot) org
Created 12/09/2007 (154 days ago)
Due
Updated 12/14/2007 (149 days ago)
Assigned
Resolved 12/14/2007 (149 days ago)
Attachments
Milestone
Patch

History
12/14/2007 Chuck Hagenbuch State ⇒ Resolved
Assigned to Jan Schneider
 
12/14/2007 xk3 (at) mompl (dot) org Comment #5 Reply to this comment
yes, works
Thanks!
12/13/2007 Jan Schneider Comment #4 Reply to this comment
12/11/2007 xk3 (at) mompl (dot) org Comment #3 Reply to this comment
horde-FRAMEWORK_3-2007-12-11
horde-HEAD-2007-12-11
turba-HEAD-2007-12-11

$attributes just before adding to LDAP at horde/turba/lib/Driver/ldap.php:266 error_log and print_r for new contact with only lastname (and email)
Array
(   
    [DUFFtype] => Object
    [cn] =>  Lastname         <-- " Lastname" with leading space
    [sn] => Lastname
    [mail] => xxx@a.com
[SNIP]

ldapsearch results in:
cn:: IExhc3RuYW1l     <-- " Lastname" with leading space (base64)
sn: Lastname
12/10/2007 Jan Schneider Comment #2
State ⇒ Feedback
Reply to this comment
This happens already. Where exactly do you see this *not* happening? And in case this has been implemented after RC1, did you try a recent snaphot?
12/09/2007 xk3 (at) mompl (dot) org Comment #1
State ⇒ New
Queue ⇒ Turba
Summary ⇒ (whitespace-)trimming of mapped attributes
Priority ⇒ 1. Low
Type ⇒ Enhancement
Reply to this comment
Mapping attributes from multiple hash values can generate hideous results if some of the attributes are not set. Example:

'name' => array('fields' => array('firstname', 'lastname'),
                          'format' => '%s %s',
                          'attribute' => 'cn'),

If firstname is not set, cn becomes " Lastname"  with a leading space.

Would be nice if mapped attributes get trimmed afterwards, maybe even on multiple whitespaces within the string. Yes, there cannot be a general trim rule, but maybe another map parameter just for the (common?) whitespace separation?