ID:               37158
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
 Status:           Analyzed
 Bug Type:         Streams related
 Operating System: n/a
 PHP Version:      5CVS-2006-04-21 (CVS)
 Assigned To:      wez
 New Comment:

The following patch corrects the issue:
http://y1.php.net/~wez/streams-37158.diff


Previous Comments:
------------------------------------------------------------------------

[2006-04-22 15:36:43] [EMAIL PROTECTED]

A change was made to wrapper resolution that mean that the plain file
wrapper is effectively aliased at alternate locations in memory.  This
fundamentally breaks the wrapper implementation macros
(PHP_STREAM_IS(...)) which absolutely rely on the wrapper structures
living at the definitive original address in memory.  Other streams
core code also relies on this being the case.

The fix is to change the wrapper hash tables to store pointers to the
wrapper structures instead of having them clone the wrapper
structures.

The reason this problem only triggered when calling
stream_wrapper_register() is that it clones the hash on the first call.
 This coupled with a change that allows scripts to override file://
causes regular plain file access (even without file://) to lookup the
cloned plain file wrapper from the cloned hash. 

------------------------------------------------------------------------

[2006-04-22 14:52:11] [EMAIL PROTECTED]

Your example is incomplete, but there was a comment to help to complete
it, next time, please provide a complete script :)

However, I found the problem, please try:
http://pear.php.net/~pierre/check_stream_plainfile_wops.txt



------------------------------------------------------------------------

[2006-04-22 04:25:13] [EMAIL PROTECTED]

"...or (after opening userspace stream) when 8192 bytes have been read
whichever comes first."

Pierre, I never opened a userspace stream.  A user stream was
registered with stream_wrapper_register(), and never used.  Read the
example code.  The only thing opened was a local file, which is very
much a built-in stream.

This would be equivalent to mysql_query() failing because the code
initialized a pdo object.  The two should not affect each other.

------------------------------------------------------------------------

[2006-04-21 22:40:09] [EMAIL PROTECTED]

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

"...or (after opening userspace stream) when 8192 bytes have been read
whichever comes first."

I think it is clear. What do you suggest to make it more clear? Reopen
and change it to "documentation" bug if you have a better text.

It is not a bug.

------------------------------------------------------------------------

[2006-04-21 22:15:15] [EMAIL PROTECTED]

P.S.  The documentation still sucks for fread() on the need to read in
chunks.

I ran into this bug because I had an fread() from a local file handle
within a streams handler (pear.php.net/PHP_Archive) that had never been
more than 8192 before.

I would recommend fixing this by adding an E_STRICT warning if a value
larger than 8192 is passed into fread()

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/37158

-- 
Edit this bug report at http://bugs.php.net/?id=37158&edit=1

Reply via email to