Answer the question
In order to leave comments, you need to log in
Can a newline at the end of a file or the LF/CRLF linefeed format cause a bug?
I analyze PHP code that has been running on the server for NN years in order to correlate it with the current code in the repository and on another server.
To simplify life, I do equivalent transformations, for example, I remove / add empty lines.
Questions:
1. Can adding/removing a newline at the end of a file be considered an equivalent transformation?
2. Is it possible to safely replace the line feed format CR + LF with LF?
Or can these transformations create an error?
On a PHP 5.6 server.
upd. Another similar question on .htaccess. I do not understand at what stage of development in the past these discrepancies appeared and whether they have independent meaning.
Answer the question
In order to leave comments, you need to log in
If there are closing php tags ?> at the end, then adding empty lines can get out and break the work / encoding / something else.
If there are no closing tags, then you can change as much as you like.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question