From:             osmium at 163 dot com
Operating system: Windows 2003, Windows 2000
PHP version:      5.1.0b3
PHP Bug Type:     Filesystem function related
Bug description:  feof() doesn't work within a class

Description:
------------
When using fseek() to specify an offset larger than or equal to the file
size, function feof() could not identify the EOF flag either in a class
method or a function, it always return FALSE. But it works outside
functions and classes.

There are same problems in version 4.3.11, 4.4.0 and 5.0.4

Reproduce code:
---------------
<?php
class FileHandler
{
        var $handle = null;
        function eof($file, $pos) {
                $this->handle = fopen($file, "r");
                fseek($this->handle, $pos);
                echo "Is EOF: ", (feof($this->handle)) ? "YES" : "NO";
        }
        
        function eof2($file, $pos) {
                $handle = fopen($file, "r");
                fseek($handle, $pos);
                echo "Is EOF: ", (feof($handle)) ? "YES" : "NO";
        }
}

function eof3($file, $pos) {
        $handle = fopen($file, "r");
        fseek($handle, $pos);
        echo "Is EOF: ", (feof($handle)) ? "YES" : "NO";
}
// my file has 32 chars only
$handler = new FileHandler();
$handler->eof($file, 320);
$handler->eof2($file, 320);
eof2($file, 320);
?>

Expected result:
----------------
Is EOF: YES
Is EOF: YES
Is EOF: YES

Actual result:
--------------
Is EOF: NO
Is EOF: NO
Is EOF: NO

-- 
Edit bug report at http://bugs.php.net/?id=34183&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=34183&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=34183&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=34183&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=34183&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=34183&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=34183&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=34183&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=34183&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=34183&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=34183&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=34183&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=34183&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=34183&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=34183&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=34183&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=34183&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=34183&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=34183&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=34183&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=34183&r=mysqlcfg

Reply via email to