|  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
Have you experienced this issue?
Rate the importance of this bug to you:

 [2003-08-08 17:15 UTC] weife01 at ca dot com
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.


Add a Patch

Pull Requests

Add a Pull Request


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]
fgets() doesn't automagically trim EOL charactres.

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]
Please provide a short but complete example script which clearly shows the problem.

 [2003-08-13 04:33 UTC]
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-2020 The PHP Group
All rights reserved.
Last updated: Wed Jan 22 17:01:25 2020 UTC