php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24991 On windows2000, only Unix EOF works
Submitted: 2003-08-08 17:15 UTC Modified: 2003-08-13 04:33 UTC
From: weife01 at ca dot com Assigned:
Status: No Feedback Package: Filesystem function related
PHP Version: 4.3.2 OS: Windows2000
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: weife01 at ca dot com
New email:
PHP Version: OS:

 

 [2003-08-08 17:15 UTC] weife01 at ca dot com
Description:
------------
I have a client who runs PHP on Windows and use the PHP script calling my program, which it initialize the DB connection. My initialization will fail if one of the text file my program reads is in Windows format with EOL as \r\n. If I feed it with Unix format as EOL(\n only), the initialization is succeed. By debugging my own code, I found that my fgets, when calling by PHP script, always return one more byte than it should, means it doesn't recognize the \r on Windows as part of EOL. I have my client set the auto_detect_line_endings in his php.ini, but it didn't help.
I have seen that you have similar bug 16708 reported, but this bug sounds reverse. I wonder if the fgets alters runtime library, and cause my fgets gets altered?

Reproduce code:
---------------
My program breaks only when calling by PHP, but I was unable to attach it here because of it's size.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-08-08 17:20 UTC] weife01 at ca dot com
On Windows2000, only Unix EOL works
 [2003-08-08 17:21 UTC] moriyoshi@php.net
fgets() doesn't automagically trim EOL charactres.

http://www.php.net/fgets

Perhaps what to do next is rtrim() it at the appropriate place of your code and see if it works.
 [2003-08-08 17:26 UTC] weife01 at ca dot com
But I couldn't rtrim() my code for it runs fine all these time until this client uses PHP script.
I'd like to find out why running under PHP, my fgets function behavour differently.
 [2003-08-08 17:44 UTC] sniper@php.net
Please provide a short but complete example script which clearly shows the problem.

 [2003-08-13 04:33 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 16:01:29 2024 UTC