implicit ob_start in require_once

时间:2015-06-15 15:09:15

标签: php output-buffering

Somewhere in my PHP script, a call to ob_start() is issued, and I am trying to find where exactly. To do this, I use xdebug, and proceed by dichotomy, calling ob_get_contents() which returns FALSE as long as ob_start() hasn't been called.

I have narrowed my code to:

<?php 
...
if ( ob_get_contents() ) { xdebug_break(); }
require_once( 'lib/local.php' );
if ( ob_get_contents() ) { xdebug_break(); }
...
?>

lib/local.php is a local, writeable file that contains nothing else than defines.

Now the funny part is this: if I replace require_once( 'lib/local.php' ) with the contents of lib/local.php, the second ob_get_contents() returns FALSE, as expected.

Now I am really puzzled at what's going on here. Insight, anyone?

0 个答案:

没有答案