ID:               30157
 Updated by:       [EMAIL PROTECTED]
 Reported By:      tendencies at free dot fr
 Status:           Assigned
 Bug Type:         Filesystem function related
 Operating System: Windows and Linux
 PHP Version:      5CVS-2004-09-19 (dev)
 Assigned To:      pollita
 New Comment:

This tell patch
(http://tony2001.phpclub.net/dev/tmp/userstreamop_tell.diff) is
"wrong"; the position should be set implicitly when the stream is
opened, and be updated by the streams layer when it knows that it is
changed (as happens when you seek).

If you need to determine the current position, you simply need to seek
with a zero offset from the current position.

Why did you need to add tell() function to the streams internals?


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

[2005-06-16 00:54:11] [EMAIL PROTECTED]

Sara, IMO it's time to commit the patch into 5.1.
What do you think?

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

[2005-04-05 23:30:52] [EMAIL PROTECTED]

Seems that Wez doesn't have enough time to work on it anymore. 
Sara, plz, take a look at this patch:
http://tony2001.phpclub.net/dev/tmp/userstreamop_tell.diff
The only problem I can see there is that all custom stream wrapper will
have to add appropriate entries too.

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

[2004-09-19 21:01:19] tendencies at free dot fr

Description:
------------
For a test, I use wrapper_register() to register a new wrapper. For
information, I use PHP5 CVS and apache.

I want to create a wrapper and use ftell() to return an integer
different from the length of the string (normal comportement). I
implement the method stream_tell() and call ftell(), but surprise, this
function don't use the method stream_tell().

Reproduce code:
---------------
<?php
class fileWrapper {
    var $fp;
    function stream_open($path, $mode, $options, &$opened_path){
        $url = parse_url($path);
        $this->fp = fopen($url["host"], $mode);
        return true;
    }
    function stream_write($data){
        return fwrite($this->fp, $data);
    }
    function stream_tell(){
        echo "debug message";
        return ftell($this->fp);
    }
    function stream_close(){
        return fclose($this->fp);
    }
}
stream_wrapper_register("test", "fileWrapper");
$fp = fopen("test://file.txt", "w+");
fwrite($fp, "test");
echo "I test the echo debug in stream_tell() method:";
echo ftell($fp)."\n";
fclose($fp);
?>

Expected result:
----------------
Use the code above, I write a "debug message" in the method
stream_tell() but no message is writted in my screen, just this :
I test the echo debug in stream_tell() method:0

I think that it's a bug but if not, all my apologies.



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


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

Reply via email to