|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #5001 String parameter data of LDAP function calls is corrupted
Submitted: 2000-06-13 14:12 UTC Modified: 2000-07-07 13:11 UTC
From: johan dot troedsson at ei dot sigma dot se Assigned: venaas (profile)
Status: Closed Package: LDAP related
PHP Version: 4.0 Release Candidate 2 OS: Linux Redhat 5.2
Private report: No CVE-ID: None
 [2000-06-13 14:12 UTC] johan dot troedsson at ei dot sigma dot se
When I create the array and strings that goes into several LDAP calls, I typically type:

$dataA[$key] = utf8_encode($value);
$searchbase = utf8_encode($dn);

This worked fine in PHP3, but in PHP4 the data transmitted is (sometimes?) corrupt as it reaches the LDAP Server. I circumvented the problem by using the trim() function on every string value (also in the arrays), before passing them to the PHP LDAP functions.

o=Company Sigma becomes o=Company Sigma??*9 
st=Oresund becomes st=Oresund2??*09:3 

The appended characters seems to be arbitrary binary values. When trying to retrieve one of the nodes holding these values, an LDAP "Decoding error" is returned.

Config line:
./configure \
--with-apache=../apache_1.3.12 \
--with-pgsql \
--with-mhash \
--with-ldap \
--disable-short-tags \
--enable-track-vars \


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2000-06-13 21:42 UTC] venaas at cvs dot php dot net
Think I found the bug, I've fixed it in CVS, please test it. The problem
was in ldap_add (and ldap_modify), and had to do with strings not
being terminated properly.


 [2000-06-19 13:28 UTC] johan dot troedsson at ei dot sigma dot se
I fetched the ldap.c file from the CVS and compiled it into a new Apache (static). But then the ldap_add function doesn't work at all for me. So, I have returned to the original release version, trimming all the string data before feeding it to the PHP LDAP API. I haven't tested it too much though.

 [2000-06-20 12:57 UTC] johan dot troedsson at ei dot sigma dot se
After some more thorough testing, the trim workaround failed (sometimes gets the LDAP error "Decoding error" when using ldap_search). So I'm back to PHP3 where everything works fine, either with or without trims.

 [2000-07-07 13:11 UTC] johan dot troedsson at ei dot sigma dot se
When analysing the problem further, I found that the corrupted bit is solved. A decoding error situation remains, described in bug report 5433.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jul 16 07:01:31 2024 UTC