6.0.0-git
2019-05-19

[#2] Carriage Return Line Feed supposed to be a $ in multiline entries in LDAP
Summary Carriage Return Line Feed supposed to be a $ in multiline entries in LDAP
Queue Turba
Queue Version HEAD
Type Enhancement
State Resolved
Priority 2. Medium
Owners Horde Developers (at)
Requester urkle (at) drip (dot) ws
Created 2004-03-07 (5551 days ago)
Due
Updated 2017-10-25 (571 days ago)
Assigned 2005-02-20 (5201 days ago)
Resolved 2005-03-21 (5172 days ago)
Milestone 2.1
Patch No

History
2017-10-25 08:25:51 Git Commit Comment #17 Reply to this comment
Changes have been made in Git (master):

commit 21e1acaad8a485ccd125d1f36b3f38ab59e81d06
Author: Michael J Rubinsky <mike@theupstairsroom.com>
Date:   Wed, 25 Oct 2017 00:29:20 -0400

Merge pull request #2 from BigMichi1/patch-2

TypeError: Argument 2 passed to Horde_Db_Adapter_Base::_replaceParameters()

  M lib/Faces/Base.php

https://github.com/horde/ansel/commit/21e1acaad8a485ccd125d1f36b3f38ab59e81d06
2017-10-25 08:25:46 Git Commit Comment #16 Reply to this comment
Changes have been made in Git (master):

commit 56d82c6574bfa544f9fd0515d312eaeb442e632a
Author: Michael Cramer <michael@bigmichi1.de>
Date:   Sun, 22 Oct 2017 14:30:10 +0200

  TypeError: Argument 2 passed to Horde_Db_Adapter_Base::_replaceParameters()

when we do a automatic face detection whit libpuzzle enabled we got an 
error about wrong argument type

2017-10-22T12:17:22+00:00 EMERG: HORDE [ansel] TypeError: Argument 2 
passed to Horde_Db_Adapter_Base::_replaceParameters() must be of the 
type array, integer given, called in 
/usr/share/php/Horde/Db/Adapter/Pdo/Base.php on line 364 and d
efined in /usr/share/php/Horde/Db/Adapter/Base.php:784
Stack trace:
#0 /usr/share/php/Horde/Db/Adapter/Pdo/Base.php(364): 
Horde_Db_Adapter_Base->_replaceParameters('face_id = ?', 5)
#1 /srv/www/docs/ansel/lib/Faces/Base.php(655): 
Horde_Db_Adapter_Pdo_Base->updateBlob('ansel_faces', Array, Array)
#2 /srv/www/docs/ansel/lib/Faces/Base.php(554): 
Ansel_Faces_Base->saveSignature(4947, 5)
#3 /srv/www/docs/ansel/lib/Ajax/Imple/EditFaces.php(50): 
Ansel_Faces_Base->getFromPicture(Object(Ansel_Image), true)
#4 /usr/share/php/Horde/Core/Ajax/Imple.php(120): 
Ansel_Ajax_Imple_EditFaces->_handle(Object(Horde_Variables))
#5 /usr/share/php/Horde/Core/Ajax/Application/Handler/Imple.php(31): 
Horde_Core_Ajax_Imple->handle(Object(Horde_Variables))
#6 /usr/share/php/Horde/Core/Ajax/Application.php(175): 
Horde_Core_Ajax_Application_Handler_Imple->imple()
#7 /srv/www/docs/services/ajax.php(61): 
Horde_Core_Ajax_Application->doAction()
#8 {main} [pid 13479 on line 74 of "/usr/share/php/Horde/ErrorHandler.php"]

  M lib/Faces/Base.php

https://github.com/horde/ansel/commit/56d82c6574bfa544f9fd0515d312eaeb442e632a
2016-01-07 16:36:42 Git Commit Comment #15 Reply to this comment
Changes have been made in Git (master):

commit df3ecf41b3d85d5ad4a2acf67449d7ceb7e42217
Author: Jan Schneider <jan@horde.org>
Date:   Thu Jan 7 15:33:19 2016 +0000

     Xdebug 2.4 adds the location to the var_dump() output. Disable completely.

  .../View/test/Horde/View/Helper/DebugTest.php      |    6 +++---
  1 files changed, 3 insertions(+), 3 deletions(-)

http://github.com/horde/horde/commit/df3ecf41b3d85d5ad4a2acf67449d7ceb7e42217
2005-03-21 01:27:43 Chuck Hagenbuch Comment #14
State ⇒ Resolved
Reply to this comment
This is committed and will be in Turba 2.1. Thanks!
2005-02-20 19:20:37 eddie (at) omegaware (dot) com Comment #13
New Attachment: postal3.diff Download
Reply to this comment
updated patch
2005-02-20 18:59:17 eddie (at) omegaware (dot) com Comment #12 Reply to this comment
Only reason I was checking just the last token was the _isString 
function did that as well.. I agree though that It should check the 
whole UID. (both functions should).



And as for the _getSchema, I do check if the _schema is a a 
Net_LDAP_Schema object and re-fetch, if it's not.  It does, however, 
make more sense to be a static member.



I'll update the patch with these two suggestions.
2005-02-20 11:12:19 Jan Schneider Comment #11
State ⇒ Assigned
Reply to this comment
Looks good. Only two minor suggestions/questions: Is there a reason 
that you don't check the schema against the full UID for the LDAP 
postal address syntax, but only the last token? And you may want to 
store the schema in _getSchema in a static variable to cache it and 
don't create a new schema object for each request.
2005-02-19 22:12:33 eddie (at) omegaware (dot) com Comment #10
New Attachment: postal2.diff Download
Reply to this comment
Here is an updated patch that adds (optional) checks on the schema if 
schema checking is enabled.. otherwise it will fail back to relying on 
the definitions in attributes.php
2005-01-16 03:16:16 Chuck Hagenbuch State ⇒ Stalled
 
2005-01-15 07:45:40 urkle (at) drip (dot) ws Comment #9
New Attachment: postal.diff Download
Reply to this comment
This should not be closed as it is a real bug that does exist and 
should be fixed.   I just haven't had the time to work on it recently, 
and as I'm not using the horde-CVS it hasn't been that high of a 
priority as I already had my own patch in the stable tree I'm using.   
I have attached an updated patch off of CVS-HEAD.



This does not use the schema checking that was added, As that is an 
"optional" feature  (checkRequired) which has to be called first to 
initialize the _schema object..   The solution attached back 
references the $GLOBALS['attributes'] configuration array after 
querying $this->map to map attribute.
2005-01-15 01:08:44 Jan Schneider Comment #8
State ⇒ Rejected
Reply to this comment
Looks like noone is really interested in this feature or at least in 
putting any work into it.
2004-09-27 08:54:57 Jan Schneider Comment #7
Type ⇒ Enhancement
State ⇒ Stalled
Priority ⇒ 2. Medium
Reply to this comment
This is rather an enhancement request than a bug.
2004-08-26 12:23:47 Jan Schneider Comment #6
State ⇒ Feedback
Reply to this comment
This patch has recently been applied to the LDAP driver that checks 
for schemes and field syntaxes: 
http://cvs.horde.org/diff.php/turba/lib/Driver/ldap.php?r1=1.49&r2=1.50&ty=u



Maybe part of this code could be used/adapted to determine the fields 
where we want line breaks encoded as "$"?
2004-04-26 20:07:24 Chuck Hagenbuch State ⇒ Assigned
Priority ⇒ 2. Medium
Taken from Chuck Hagenbuch
Assigned to Horde DevelopersHorde Developers
 
2004-04-20 19:26:58 cani (at) do (dot) it Comment #5 Reply to this comment
Suggested priority: 3. High

don't be silly
2004-03-25 17:53:51   Comment #4
New Attachment: ldapaddress.patch
Reply to this comment
Here is an updated patch off of the CVS turba..

I'm the same person as urkle@d.

A few notes though, right now I am explicitly checking for 
homepostaladdress, postaladdress, otherpostaladdress, and 
registeredaddress with that lovely regular expression. As those are 
the standard core scheme that use this syntax.

It would be better if there were a way to access what type of field is 
being processed from within the driver,, or a sheme query on the LDAP 
to determine what attributes are of the syntax 
1.3.6.1.4.1.1466.115.121.1.41.

And this breaks things with evolution, as I am waiting for them to 
accept my patch to fix the bug there as well. Neeed to update it for 
the 1.5CVS release.
2004-03-25 17:53:50 eddie (at) omegaware (dot) com Comment #3 Reply to this comment
Here is an updated patch off of the CVS turba..

I'm the same person as urkle@d.

A few notes though, right now I am explicitly checking for 
homepostaladdress, postaladdress, otherpostaladdress, and 
registeredaddress with that lovely regular expression. As those are 
the standard core scheme that use this syntax.

It would be better if there were a way to access what type of field is 
being processed from within the driver,, or a sheme query on the LDAP 
to determine what attributes are of the syntax 
1.3.6.1.4.1.1466.115.121.1.41.

And this breaks things with evolution, as I am waiting for them to 
accept my patch to fix the bug there as well. Neeed to update it for 
the 1.5CVS release.
2004-03-25 17:13:59 Chuck Hagenbuch State ⇒ Assigned
Priority ⇒ 2. Medium
Assigned to Chuck Hagenbuch
 
2004-03-07 17:30:28 Chuck Hagenbuch Comment #2 Reply to this comment
This patch fixes an issue with Turba 1.2 where it would insert a Carriage

Return, Line Feed instead of just Line Feed between the lines of a

multiline entry (ie. home address)  This causes a problem with Evolution

where evolution will not display the entry in the address book if there is

a carriage return in the entry..  But the entries should only have line

feeds..



Patch for Turba 1.2 AND CVS HEAD





------- Additional Comments From urkle@drip.ws  06/17/03 16:45 -------

CVS HEAD Patch

--- ldap.php.orig        Fri Jun 13 10:21:15 2003

+++ ldap.php        Tue Jun 17 14:41:25 2003

@@ -302,10 +302,10 @@

          // Don't add empty attributes.

          $attributes = array_filter($attributes, array($this,

'cleanEmptyAttributes'));



-        // Encode entries.

+        // Encode entries & do CRLF to LF conversion

          foreach ($attributes as $key => $val) {

              if (!is_array($val)) {

-                $attributes[$key] = String::convertCharset($val,

NLS::getCharset(), $this->charset);

+                $attributes[$key] =

String::convertCharset(str_replace("\r\n",\n",$val), NLS::getCharset(),

$this->charset);

              }

          }



@@ -377,7 +377,7 @@

          // Encode entries.

          foreach ($attributes as $key => $val) {

              if (!is_array($val)) {

-                $attributes[$key] = String::convertCharset($val,

NLS::getCharset(), $this->charset);

+                $attributes[$key] =

String::convertCharset(str_replace("\r\n","\n",$val), NLS::getCharset(),

$this->charset);

              }

          }







------- Additional Comments From urkle@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'));





------- Additional Comments From urkle@drip.ws  03/06/04 23:39 -------

A way needs to be created to let the driver know that the field type is of

postal address..



------- Additional Comments From urkle@drip.ws  03/07/04 00:12 -------

patch to completely fix this bug.

change both ocurrances of

  $val = str_replace("\r\n","\n",$val);

in the second patch posted to this.

if (preg_match("/^((home|other)?postal|registered)address$/",%key)) {

     $val = str_replace(array("\r\n","\n"),array("$","$"),$val);

}



and then in the getResults function (around line 243)

  if ($field == 'dn') {

      $resul[$field] = $entry[$field];

+} elseif (preg_match("/^((home|other)?postal|registered)address$/",$field)) {

+    if (!empty($entry[$field])) {

+        if ($this->encoding == 'utf8') {

+            $result[$field] = utf8_decode($entry[$field][0]);

+        }

+    }

+    $result[$field] = str_replace("$","\r\n",$result[$field]);

  } else {

      $result[$field] = '';

      if (!empty($entry[$field])) {



And
2004-03-07 17:27:48 urkle (at) drip (dot) ws Comment #1
Type ⇒ Bug
State ⇒ Unconfirmed
Priority ⇒ 2. Medium
Reply to this comment
This patch fixes an issue with Turba 1.2 where it would insert a Carriage

Return, Line Feed instead of just Line Feed between the lines of a

multiline entry (ie. home address)  This causes a problem with Evolution

where evolution will not display the entry in the address book if there is

a carriage return in the entry..  But the entries should only have line

feeds..



Patch for Turba 1.2 AND CVS HEAD





------- Additional Comments From urkle@drip.ws  06/17/03 16:45 -------

CVS HEAD Patch

--- ldap.php.orig        Fri Jun 13 10:21:15 2003

+++ ldap.php        Tue Jun 17 14:41:25 2003

@@ -302,10 +302,10 @@

          // Don't add empty attributes.

          $attributes = array_filter($attributes, array($this,

'cleanEmptyAttributes'));



-        // Encode entries.

+        // Encode entries & do CRLF to LF conversion

          foreach ($attributes as $key => $val) {

              if (!is_array($val)) {

-                $attributes[$key] = String::convertCharset($val,

NLS::getCharset(), $this->charset);

+                $attributes[$key] =

String::convertCharset(str_replace("\r\n",\n",$val), NLS::getCharset(),

$this->charset);

              }

          }



@@ -377,7 +377,7 @@

          // Encode entries.

          foreach ($attributes as $key => $val) {

              if (!is_array($val)) {

-                $attributes[$key] = String::convertCharset($val,

NLS::getCharset(), $this->charset);

+                $attributes[$key] =

String::convertCharset(str_replace("\r\n","\n",$val), NLS::getCharset(),

$this->charset);

              }

          }


Saved Queries