jd182
jd182

Reputation: 3260

var_dump, print_r produces 'Content Encoding Error'

i'm trying to debug some code, every time I use var_dump in Chrome I get an error which says 'Content Encoding Error'.

In Opera var_dump almost works as expected, but there is a whole bunch of garbled text and symbols after it. Here's the first part:

bool(false) array(1) { [0]=> string(1) "1" } array(1) { [0]=> string(1) "3" } array(2)   { [0]=> string(1) "2" [1]=> string(1) "3" } ��Y�n��;�x*P����G��^����ޡ��?��@K�͘u$e��F}�>YgHY��8�.

I am able to use var_dump on other sites on the same server, all running the same version of PHP and within the same PHP framework.

Does anybody know what could be causing this? The server is running PHP 5.2.17.

Edit - Some more info.

It happens when I try to var_dump anything, for example:

$test = 'test';   
var_dump($test);

Here's the header encoding details:

Content-Type: text/html; charset=UTF-8

Upvotes: 0

Views: 973

Answers (2)

Enchanter
Enchanter

Reputation: 17

Can happen if an output buffer is open and a limit reached. Try:

var_dump($anything);
ob_flush();

Upvotes: 0

user3383675
user3383675

Reputation: 1081

If I want to use force charset on var_dump, I usually type:

echo "<meta charset='UTF-8'>";
var_dump($test);

Upvotes: 0

Related Questions