php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #43515 dir(): doc incorrectly suggests that the Directory class has a constructor
Submitted: 2007-12-06 10:46 UTC Modified: 2008-01-07 20:08 UTC
From: robin_fernandes at uk dot ibm dot com Assigned:
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: *
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: robin_fernandes at uk dot ibm dot com
New email:
PHP Version: OS:

 

 [2007-12-06 10:46 UTC] robin_fernandes at uk dot ibm dot com
Description:
------------
The documentation for the dir() function, which returns an instance of the Directory class, has a list of functions and properties for that class. It lists a non-existent constructor: Directory(string $directory).

This is significant, because it incorrectly implies that it would be possible to "new up" a working instance of the Directory class by passing a path to this ctor. In fact, this will not work, because Directory has no such constructor, and the essential $handle and $path properties are created and set explicitly for each instance in the implementation of the dir() function.

The reflection code below confirms that Directory::Directory($string) does not exists, and that the $handle and $path properties are created dynamically.

Reproduce code:
---------------
<?php
ReflectionClass::export("Directory");
?>

Expected result:
----------------
N/A

Actual result:
--------------
Class [ <internal:standard> class Directory ] {

  - Constants [0] {
  }

  - Static properties [0] {
  }

  - Static methods [0] {
  }

  - Properties [0] {
  }

  - Methods [3] {
    Method [ <internal:standard> public method close ] {
    }

    Method [ <internal:standard> public method rewind ] {
    }

    Method [ <internal:standard> public method read ] {
    }
  }
}

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-01-07 20:08 UTC] bjori@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.


 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Oct 07 21:00:02 2026 UTC