0

i have a site, where i buffer some output with

ob_start();
... 

and it worked fine until today i updated my debian from an older php5.3 to the latest php5.3.3-7+squeeze8
Now i sometimes have something in the output buffer before i call it the first time

please don't answer things like

"header must be called before any output is sent." (I know, I work a lot with output buffers)

when i set an extra ob_get_clean(); at the very first line of my script, it works

<?
ob_get_clean();

it seems, like php is creating some output beforehand if i put the first line

<? print_r(ob_get_clean()); ?>

then i see, that there is an empty string already in the buffer:

""

on all other pages it isn't, there ob_get_clean(); contains

null

rubo77
  • 19,527
  • 31
  • 134
  • 226
  • Seen this before .... you don't see it but there is something there ... delete the file and recreate it ... if possible use another editor or just notepad ... – Baba Apr 09 '12 at 11:44
  • related to [Headers already sent](http://stackoverflow.com/questions/8028957/headers-already-sent-by-php), see the hexeditor thing and outbut buffering section. – mario Apr 09 '12 at 20:55

4 Answers4

0

is it possible you have some " " in front of your <?php somewhere? or wrong file encoding issue its usually some kind of that nature, check your files and include files.

worenga
  • 5,776
  • 2
  • 28
  • 50
0

Now i sometimes have something in the output buffer before i call it the first time

It'll be much easier if you give us some info about that mysterious data.

deadrunk
  • 13,861
  • 4
  • 29
  • 29
0

perhaps a case of BOM character? more info here

andrew
  • 2,058
  • 2
  • 25
  • 33
0

i found it:

i had no invisible character in front, it was something different: i called ob_end_clean() one time too much:

this was my code, inside a function i call:

function print_something(){
ob_start();

echo some stuff...

echo ob_get_clean();
ob_end_clean(); // this was the bug! 
}

it seems, that you can clear your main output buffer ;)

rubo77
  • 19,527
  • 31
  • 134
  • 226