php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30567 Problems encoding to utf8 when adding an entry into the LDAP
Submitted: 2004-10-26 18:16 UTC Modified: 2004-12-12 01:34 UTC
From: leticia dot borrajo at gmail dot com Assigned:
Status: Not a bug Package: LDAP related
PHP Version: 4.3.8 OS: Linux Fedora Core 1
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: leticia dot borrajo at gmail dot com
New email:
PHP Version: OS:

 

 [2004-10-26 18:16 UTC] leticia dot borrajo at gmail dot com
Description:
------------
We work with OpenLDAP 2.1.22 and PHP 4.3.8
I'm working in a set of applications to manage our LDAP directory.
We archive into the LDAP information about users, and need to save spanish characters, such as "?", "?",...
So when I try to add an entry into the ldap, I apply "utf8_encode" to some attributes. By the moment these attributes are: 'cn', 'sn' and 'gecos'.
When this happens, I have 2 problems:
1. In 'sn' there use to be 2 words, first surname and second surname, and after apply utf8_encode, it deletes the second surname.
2. When I try to add the entry into the ldap, I get an error and it can't be done

Any idea?

Reproduce code:
---------------
The code is this:

$info['uid']=$uid;
$info['cn']=utf8_encode($cn);
$info['sn']=utf8_encode($sn);
$info['userPassword']="{MD5}".base64_encode(pack("H*",md5($clave)));
$info['gecos']=utf8_encode($gecos);
$info['ou']=$ou;
$ds=ldap_connect($servidor);
if($ds) {
	$user="cn=Administrador,o=ou.uvigo.es";
	$r=ldap_bind($ds,$user,$cla);
	if ($r)
	{
		$a?ade= ldap_add($ds,$usuario,$info);
		...
	}
}

Expected result:
----------------
If everything were ok, I would see "Usuario a?adido con ?xito". Instead of that I only get "Invalid syntax". 

Actual result:
--------------
The actual result is:

Warning: ldap_add(): Add: Invalid syntax in /var/www/html/proyecto/crear_usuario.php on line 70

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-12-12 01:34 UTC] sniper@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

This is not support forum to ask HOW to use PHP.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 03 16:01:30 2024 UTC