|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40459 Stat and Dir stream wrapper methods do not call constructor
Submitted: 2007-02-13 07:01 UTC Modified: 2012-08-09 07:13 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: clay at killersoft dot com Assigned: stas
Status: Closed Package: Streams related
PHP Version: 5.2.1 OS: irrelevant
Private report: No CVE-ID:
 [2007-02-13 07:01 UTC] clay at killersoft dot com
The following methods in a userspace stream wrapper will not call the constructor:


Reproduce code:

Expected result:
Any time a line of output beginning with '== [method] CALLED' appears, that line should contain an 'obj: ' value with a uniqid value, indicating that the constructor was called.

Actual result:
== dir_opendir METHOD CALLED (obj: ) ==
== dir_readdir METHOD CALLED (obj: ) ==
== dir_closedir METHOD CALLED (obj: ) ==
== url_stat METHOD CALLED (obj: ) ==
== mkdir METHOD CALLED (obj: ) ==
== rmdir METHOD CALLED (obj: ) ==
== unlink METHOD CALLED (obj: ) ==
== rename METHOD CALLED (obj: ) ==


bug-40459 (last revision 2012-05-04 12:46 UTC) by

Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-07-21 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2012-05-04 12:46 UTC]
The following patch has been added/updated:

Patch Name: bug-40459
Revision:   1336135565
 [2012-05-04 12:47 UTC]
I believe this issue is still present. I have attached a test case to demonstrate the problem.

When looking at main/streams/userspace.c, it is clear that only in user_wrapper_opener() the constructor of the user space class is called (the "if (uwrap->ce->constructor) {}" block).
 [2012-05-04 12:48 UTC]
-Status: No Feedback +Status: Re-Opened
 [2012-08-07 23:46 UTC]
-Assigned To: wez +Assigned To: stas
 [2012-08-07 23:48 UTC]
See also:
 [2012-08-09 07:12 UTC]
Automatic comment on behalf of stas
Log: fix bug #40459 - make all stream funcs that create object call ctor
 [2012-08-09 07:13 UTC]
-Status: Re-Opened +Status: Closed
 [2012-08-09 07:13 UTC]
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at

 For Windows:
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Fri Apr 18 13:02:15 2014 UTC