php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43779 ldap_explode_dn() returns superfluous "count"
Submitted: 2008-01-07 20:50 UTC Modified: 2008-11-08 01:32 UTC
From: gabe at mudbugmedia dot com Assigned:
Status: Not a bug Package: LDAP related
PHP Version: 5.2.6 OS:
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: gabe at mudbugmedia dot com
New email:
PHP Version: OS:

 

 [2008-01-07 20:50 UTC] gabe at mudbugmedia dot com
Description:
------------
The documentation for ldap_explode_dn says that the return value should 
be "Returns an array of all DN components.".  Not only is this vague (a 
separate problem), it fails to document that the returned array is an 
associative array where the first key/value being 'count' => (integer), 
where the count is the total number of elements in the array.

Reproduce code:
---------------
$dn="cn=example,dc=example,dc=com";
var_dump(ldap_explode_dn($dn,0));

Expected result:
----------------
array(3) {
  [0]=>
  string(19) "cn=example"
  [1]=>
  string(19) "dc=example"
  [2]=>
  string(4) "dc=com"
}

Actual result:
--------------
array(3) {
  ["count"]=>
  int(3)
  [0]=>
  string(19) "cn=example"
  [1]=>
  string(19) "dc=example"
  [2]=>
  string(4) "dc=com"
}

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-11-07 14:08 UTC] vrana@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.

"The first element in this array has count key and represents the number of returned values, next elements are numerically indexed DN components."
 [2008-11-07 14:10 UTC] vrana@php.net
The "count" element is unnecessary as PHP has count() function.
 [2008-11-08 01:32 UTC] jani@php.net
It's not a bug, and removing it would break BC.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed May 01 13:01:31 2024 UTC