Gzip Headers in Php Output

Gzip Headers in Php Output

I have noticed wierd binary characters being generated after var_dump of ( $_POST, $HTTP_POST_VARS, and $_REQUEST ) when debugging CMS code. Before these characters there were empty array(0){} statements in the output.

Gzip Headers in Php Output – Details

I noticed that the code always had similar output and a very specific pattern to it. This led me to believe that the server integrity was most definitely somehow compromised or that a module was somehow spitting out garbage. There are a lot of tricky functions in CMS code that allow it to do its job properly like using output buffering functions and weird closures and in a given CMS unless you are well blessed with knowledge on that particular one might prove to be a daunting task. Example: Bad Output. What it is supposed to look like: Good Output, and without gzip at all: No Gzip

The Problem

As a result, I started looking a bit closer at the code and noticed that if I removed the echo, var_dump or print_r statements, that the template would be filled out properly and everything would resume as normal. After a couple of web server service reboots, I realized that the problem was not going to remove itself easily. As a result I was forced to investigate into the CMS loading code. Upon further inspection of the application top code “application_top.php” I noticed a rather interesting function call: header ( &squo;…&squo;). I immediately realized two issued were upon me: 1, the header was being broken and was outputting after the actual header was being sent and thus being ignored completely, and 2, the header statement was not being read as a header and therefore ignoring the compressed output I was sending using php&squo;s buffering mechanisms. To fix this situation, I merely moved my output code directly after the application_top.php include.

ttessier

About ttessier

Professional Developer and Operator of SwhistleSoft
This entry was posted in C Programming and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *