Mombu the Php Forum sponsored links

Go Back   Mombu the Php Forum > Php > #34183 : feof() doesn't work within a class
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 10th April 19:09
php-bugs
External User
 
Posts: 1
Default #34183 : feof() doesn't work within a class



ID: 34183
User updated by: osmium at 163 dot com
Reported By: osmium at 163 dot com
Status: Open
Bug Type: Filesystem function related
Operating System: Windows 2003, Windows 2000
PHP Version: 5.1.0b3
New Comment:

thers is something wrong about my English


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

[2005-08-18 10:48:21] osmium at 163 dot com

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 this bug report at http://bugs.php.net/?id=34183&edit=1
  Reply With Quote


  sponsored links


Reply


Thread Tools
Display Modes




Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666