From:             admin at kthxbai2u dot com
Operating system: Linux
PHP version:      5.3.0
PHP Bug Type:     Unknown/Other Function
Bug description:  fgets returns 2 lines

Description:
------------
When I use fgets() it returns the line, and the next one...

Correct me if I am wrong, but when you ask for one line, it should return
one line?

There is not even a function (that I have found yet) that returns ONLY 1
line...

fgets should not be adding a /r/n at the end, that should be up to the
programmer...

Reproduce code:
---------------
---
>From manual page: function.fgetss
---

$fp = fopen("AD_SYSTEM/popup.ads",'r'); 

while($line=fgets($fp)) 
{ 
//add the link text to the array
$ads[] = $line;
}

 
fclose($fp); 

echo $ads[1];

Expected result:
----------------
"http://somepopup.url/advertisement.html"; (without quotes)

Actual result:
--------------
"http://somepopup.url/advertisement.html
" (without quotes, notice the 2nd line)

-- 
Edit bug report at http://bugs.php.net/?id=49228&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=49228&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=49228&r=trysnapshot53
Try a snapshot (PHP 6.0):            
http://bugs.php.net/fix.php?id=49228&r=trysnapshot60
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=49228&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=49228&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=49228&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=49228&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=49228&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=49228&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=49228&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=49228&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=49228&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=49228&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=49228&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=49228&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=49228&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=49228&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=49228&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=49228&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=49228&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=49228&r=mysqlcfg

Reply via email to