tags:

views:

88

answers:

2

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?

A: 

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.

You should check your php error logs.

Ryu
I am his co-worker. The error log yields nothing relevant.
Chad Johnson
+1  A: 

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.

Hippo
+1 for Byte-Order Mark; can be a real pain since PHP will evaluate it as output.
Dereleased
Could be related to this: http://bugs.php.net/bug.php?id=8858
Chad Johnson