php.net |  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
Votes:2
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 (profile)
Status: Closed Package: Streams related
PHP Version: 5.2.1 OS: irrelevant
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: clay at killersoft dot com
New email:
PHP Version: OS:

 

 [2007-02-13 07:01 UTC] clay at killersoft dot com
Description:
------------
The following methods in a userspace stream wrapper will not call the constructor:

url_stat()
dir_opendir()
rmdir()
mkdir()
rename()
unlink()


Reproduce code:
---------------
http://killersoft.com/misc/Test_Stream.php.txt

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: ) ==
...

Patches

bug-40459 (last revision 2012-05-04 12:46 UTC by jschippers@php.net)

Pull Requests

History

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] jschippers@php.net
The following patch has been added/updated:

Patch Name: bug-40459
Revision:   1336135565
URL:        https://bugs.php.net/patch-display.php?bug=40459&patch=bug-40459&revision=1336135565
 [2012-05-04 12:47 UTC] jschippers@php.net
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] jschippers@php.net
-Status: No Feedback +Status: Re-Opened
 [2012-08-07 23:46 UTC] stas@php.net
-Assigned To: wez +Assigned To: stas
 [2012-08-07 23:48 UTC] stas@php.net
See also: https://github.com/php/php-src/pull/93
 [2012-08-09 07:12 UTC] stas@php.net
Automatic comment on behalf of stas
Revision: http://git.php.net/?p=php-src.git;a=commit;h=4db70fd406c805a296f4531088fe716a1ef67158
Log: fix bug #40459 - make all stream funcs that create object call ctor
 [2012-08-09 07:13 UTC] stas@php.net
-Status: Re-Opened +Status: Closed
 [2012-08-09 07:13 UTC] stas@php.net
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
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 [2014-10-07 23:23 UTC] stas@php.net
Automatic comment on behalf of stas
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=4db70fd406c805a296f4531088fe716a1ef67158
Log: fix bug #40459 - make all stream funcs that create object call ctor
 [2014-10-07 23:34 UTC] stas@php.net
Automatic comment on behalf of stas
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=4db70fd406c805a296f4531088fe716a1ef67158
Log: fix bug #40459 - make all stream funcs that create object call ctor
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 08 15:01:28 2024 UTC