Skip to content

Instantly share code, notes, and snippets.

@byteranger
Created October 2, 2015 22:42
Show Gist options
  • Save byteranger/fac2076f28bbd8c9c20f to your computer and use it in GitHub Desktop.
Save byteranger/fac2076f28bbd8c9c20f to your computer and use it in GitHub Desktop.
<?php
/*
TESTED:
CentOS/WHM/CPanel
Apache 2.4
PHP 5.5.29
suPHP
CGI/FastCGI
AND
Debian
Lighttpd 1.4.31
PHP 5.4.45
FPM/FastCGI
*/
if (!ob_start(null, 0, PHP_OUTPUT_HANDLER_CLEANABLE)) echo 'could not open output buffer...';
//TODO: include 'somecontent.php';
echo 'some content that shouln\'t be seen because it gets extracted from the buffer into a variable...';
//ORIGINALLY USING THIS, BUT HID THE FAILURE OF ob_end_clean BELOW: $html = ob_get_clean();
$html = ob_get_contents();
if (!ob_end_clean()) echo 'could not clean output buffer...';
echo 'script finished...';
//RESULT: some content that shouln't be seen because it gets extracted from the buffer into a variable...could not clean output buffer...script finished...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment