php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15550 Fgets don?t get a file line correctly
Submitted: 2002-02-14 05:45 UTC Modified: 2002-07-11 02:28 UTC
From: jomarca1 at eresmas dot com Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 4.1.1 OS: W98
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jomarca1 at eresmas dot com
New email:
PHP Version: OS:

 

 [2002-02-14 05:45 UTC] jomarca1 at eresmas dot com
I programmed a function that gets lines from file.
/****************************************************/
$desc_fichero= fopen($fichero,"r");
	$correcto = $correcto & $desc_fichero;
	if($desc_fichero){/***  Si el fichero se abre correctamente   ******/
		while(!feof($desc_fichero))
		{	
			$linea= fgets($desc_fichero,1000);
			$linea = trim($linea);
						
			if (!empty($linea)..........
In version 4.0.6 fgets took the file line as is(Whith all characters).In newer version 4.1.1.converts the diferent tabs to a one space.Example:
"Hi->->->How are you": 4.1.1= "Hi how are you" .
4.0.6:"Hi->->->How are you":
Thanks

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-11 02:28 UTC] sniper@php.net
Use 'fopen($fichero, "rb")' (binary mode)

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 11:01:34 2025 UTC