Line breaks causing php bugs?
I have a php form process script that wasn't saving correctly on our live or test severs but was working in my local test environment. I committed some trivial changes to the file and it started processing correctly. I then reverted those changes and thing still worked correctly.
I'm wondering开发者_开发知识库 if there was possibly some line breaks / newlines or other hidden characters that were in there causing the problem. Has anyone else experienced anything like this?
My first thoughts would go for the following things to check:
- If you get somekind of header already sent errors check for BOM-Bytes or other invisible char at the start of your script
- Are you using non-englisch characters for html/form names or php variables check the encoding of all files. It must be the the same everywhere
- Google arround for php lineending-settings. A while ago I heard about somethings that could occour if lineendings were wrong.
EDIT: Otherwise it would be helpfull if you give us some example code.
You might have had a hidden character before your opening <?php
tag.
If you were doing any header manipulation or session_start()
it will fail because if <?php
isn't the first thing in the file then the server will start it's response.
- PHP header function
- session_start()
You should check your php error logs.
精彩评论