ID: 42228
Updated by: [EMAIL PROTECTED]
Reported By: nikhil dot gupta at in dot ibm dot com
-Status: Open
+Status: Wont fix
Bug Type: Filesystem function related
Operating System: Linux, Win32-xp
PHP Version: 4CVS-2007-08-07 (CVS)
New Comment:
We are sorry, but we can not support PHP 4 related problems anymore.
Momentum is gathering for PHP 6, and we think supporting PHP 4 will
lead to a waste of resources which we want to put into getting PHP 6
ready.
Previous Comments:
------------------------------------------------------------------------
[2008-02-11 14:38:34] sb1304 at hotmail dot com
<?php
$fp = fopen("file2.tmp", "w");
$csv_string = "\n";
fwrite($fp, $csv_string);
fclose($fp);
$fp = fopen("file2.tmp", "r");
var_dump( ftell($fp) );
var_dump( fgetcsv($fp) );
var_dump( ftell($fp) );
var_dump( feof($fp) );
var_dump( fseek($fp, 0, SEEK_END) );
var_dump( ftell($fp) );
var_dump( fgetc($fp) );
var_dump( feof($fp) );
fclose($fp);
?>
Gives:
int(0)
array(1) {
[0]=>
string(0) ""
}
int(1)
bool(false)
int(0)
int(1)
bool(false)
bool(true)
And a feof of true. Same result as in 42175?
S
------------------------------------------------------------------------
[2007-08-07 05:40:24] nikhil dot gupta at in dot ibm dot com
Description:
------------
feof() is failing to detect the end of file for a file containing a
blank file ("\n" character only).
This behaviour is seen on php5 and php6 both.
Reproduce code:
---------------
<?php
$fp = fopen("file2.tmp", "w");
$csv_string = "\n";
fwrite($fp, $csv_string);
fclose($fp);
$fp = fopen("file2.tmp", "r");
var_dump( ftell($fp) );
var_dump( fgetcsv($fp) );
var_dump( ftell($fp) );
var_dump( feof($fp) );
var_dump( fseek($fp, 0, SEEK_END) );
var_dump( ftell($fp) );
var_dump( feof($fp) );
fclose($fp);
?>
Expected result:
----------------
int(0)
array(1) {
[0]=>
string(0) ""
}
int(1)
bool(true)
int(0)
int(1)
bool(true)
Actual result:
--------------
int(0)
array(1) {
[0]=>
string(0) ""
}
int(1)
bool(false)
int(0)
int(1)
bool(false)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=42228&edit=1