From:             x dot philbert at pixandlog dot com
Operating system: Gentoo Linux
PHP version:      5.1.2
PHP Bug Type:     SPL related
Bug description:  SplFileObject->fgets()

Description:
------------
Hello.

I can't use a maximum lenght with fgets of SplFileObject. After one test,
results are not correct with parameter maximum length.
Here is my file :
[www]$ cat tmpfile.txt
abcdefgh
pqrstuvwxyz

[www]$


Reproduce code:
---------------
<?php
$fi1 = new SplFileObject('tmptest/tmpfile.txt');
$fi1->setMaxLineLen(2);
echo 'MaxLineLenght = '.$fi1->getMaxLineLen().'<br />';
echo 'fgets = ['.$fi1->fgets().']<br />';
echo 'fgets = ['.$fi1->fgets().']<br />';
echo 'fgets = ['.$fi1->fgets().']<br />';
?>


Expected result:
----------------
MaxLineLenght = 2
fgets = [a]
fgets = [b]
fgets = [c]


Actual result:
--------------
MaxLineLenght = 2
fgets = [abcdefgh ]
fgets = [pqrstuvwxyz ]
fgets = []


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

Reply via email to