ID:               33825
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Open
+Status:           Bogus
 Bug Type:         Filesystem function related
 Operating System: windows XP
 PHP Version:      5.1.0b3
 New Comment:

See Bug #27508; 5.0 actually was broken and flipped the meaning of the
return value (blame hartmut for that one, I think :)

Aside from that, your sample script still doesn't work properly or make
much sense.


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

[2005-07-22 19:42:40] [EMAIL PROTECTED]

since there has been some question of the brilliance of the test script
on irc, I will provide one that appeals to the objectors

<?php
class Mystream
{
    private $snobs = 0;
    function stream_open()
    {
        return true;
    }

    function stream_eof()
    {
        var_dump($this->snobs);
        return !($this->snobs >= 99);
    }

    function stream_seek($a)
    {
        $this->snobs = $a;
        return true;
    }

    function stream_tell()
    {
        return $this->snobs;
    }
}
stream_wrapper_register('testing', 'Mystream');
$fp = fopen('testing://blah', 'r');
var_dump(1, feof($fp));
fseek($fp, 100);
Mystream::$a = true;
var_dump(2, feof($fp));
?>

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

[2005-07-22 18:51:46] [EMAIL PROTECTED]

Description:
------------
in 5.0.4, if stream_eof() returns false, feof() returns true, in
5.1.0b3, if stream_eof() returns true, feof() returns true.

In addition to the small test below, a slightly larger real-world
streams test is available in cvs at pear/PHP_Archive/tests/eof.phpt

Reproduce code:
---------------
<?php
class Mystream
{
    static $a = false;
    function stream_open()
    {
        return true;
    }

    function stream_eof()
    {
        var_dump(self::$a);
        return self::$a;
    }

    function stream_seek()
    {
        return true;
    }

    function stream_tell()
    {
        return 0;
    }
}
stream_wrapper_register('testing', 'Mystream');
$fp = fopen('testing://blah', 'r');
var_dump(1, feof($fp));
fseek($fp, 100);
Mystream::$a = true;
var_dump(2, feof($fp));
?>

Expected result:
----------------
bool(false)
int(1)
bool(true)
bool(true)
int(2)
bool(false)

Actual result:
--------------
bool(false)
int(1)
bool(false)
bool(true)
int(2)
bool(true)


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


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

Reply via email to