php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #55248 example data are inconsistent
Submitted: 2011-07-20 06:25 UTC Modified: 2013-05-07 07:27 UTC
From: drupal at paratio dot com Assigned: salathe (profile)
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: Ubuntu 10.4 LTS
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: drupal at paratio dot com
New email:
PHP Version: OS:

 

 [2011-07-20 06:25 UTC] drupal at paratio dot com
Description:
------------
---
From manual page: http://www.php.net/function.ldap-add%23Examples
---

This are the example data:
$info["cn"] = "John Jones";
$info["sn"] = "Jones";
$info["mail"] = "jonj@example.com";
$info["objectclass"] = "person";

The objectclass "person" does not contain the mail attribute. So this example 
doesn't work with LDAP.
Just remove the mail entry or expand the example with the object class 
"inetOrgPerson" where "mail" is a MAY attribute.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-07-27 22:30 UTC] frozenfire@php.net
-Status: Open +Status: Feedback
 [2011-07-27 22:30 UTC] frozenfire@php.net
I'd prefer to make the latter change, expanding the example, rather than removing 
that bit. But, I've not used LDAP, so I'm unsure how to represent that 
functionality. Could you provide some example code to do so? I'd greatly 
appreciate that.

Otherwise, I'll just remove the line.
 [2011-12-02 17:14 UTC] drupal at paratio dot com
Hello frozenfire,
I think who wants to use this php function should know how LDAP works.

We can provide two examples are the best way to describe how to handle a simple and a more complex LDAP data entry.

In the the first example the mail-attribute should be removed because it's wrong:
$info["cn"] = "John Jones";
$info["sn"] = "Jones";
$info["objectclass"] = "person";
 
The second example with email is a little bit more complex because a second objectclass:
$info["cn"] = "John Jones";
$info["sn"] = "Jones";
$info["mail"] = "jonj@example.com";
$info["objectclass"][] = "person";
$info["objectclass"][] = "inetOrgPerson";

Maybe an information about LDAP is helpful because LDAP only accept right structured data. If you want to save any kind of 
attribute you have to declare additionally the right objectclass. The next thing to understand is that the LDAP server has 
to know the right information schema where the objectclasses are described. This only ca be handled with LDAP 
configuration not by PHP.
The objectclass "person" is provided by the schema "core" and the objectclass "inetOrgPerson" is provided by the schema 
"inetorgperson". If somebody needs other data structures as existing schemas can provide there is only one clean way to 
declare: You need to request an organisation number from the IANA (Internet Assigned Numbers Authority). 

kind regards,
Carsten
 [2011-12-02 17:14 UTC] drupal at paratio dot com
-Status: Feedback +Status: Open
 [2011-12-07 07:17 UTC] frozenfire@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: frozenfire
 [2011-12-21 19:01 UTC] frozenfire@php.net
-Status: Assigned +Status: Open -Assigned To: frozenfire +Assigned To:
 [2013-05-07 07:27 UTC] salathe@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.

Fixed in revision 330183 by removing the 'mail' line.
 [2013-05-07 07:27 UTC] salathe@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: salathe
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Mar 16 02:01:28 2025 UTC