-1

Code:

$result = "Hello World";
$jsonEncodeValue = $result;
echo $jsonEncodedValue;

Assumed Output:

"Hello World"

Real Output:

\n"Hello World"

This \n Line Feed added automatically.

For this extra Line Feed my result breaks down while parsing through JSON parser. I am trying several hours to solve the issues.

I have checked at

  • .htaccess is there any auto_prepend file exists which adds extra Line Feed, but not. I didn't get anything.
  • Cgi-bin file is there any malicious code exists that adds extra Line Feed, but not. Didn't get anything.

My Question:

  • Is someone injecting HTML or PHP code?
  • If then, how to detect from where code injection is running (is there any way to find out from which file code injection is running) and how to prevent?
2
  • Is this occurring when you put your input in? Have you verified the source against your local source repository? Based on how it is currently described, this sounds like it is most likely a programming error and is probably a better fit for stack overflow. Feb 11, 2013 at 14:01
  • @AJHenderson, While I am running this script in my localhost server, then running well. Even while running on Another Web Server then running well. But while running on our current dedicated server then at every script I am facing this problem. Feb 11, 2013 at 14:13

1 Answer 1

1

it seems to me that you are facing more of an encoding issue rather than a security one. windows uses CRLF, unix uses LF, mac uses CR. encoding may affect these behaviors. is the dedicated server has the same configuration as the 2 other boxes? you may need to compare. also you may probably had the need to check your editor and the encoding of your source codes.

1
  • Yes. The Dedicated server has the same configuration as the 2 other boxes. Even two sub-domains reacts differently, i.e. subdomain1 reacts as assumed output and subdomain2 reacts as real output. Feb 12, 2013 at 3:32

Not the answer you're looking for? Browse other questions tagged .