@@ -1220,6 +1220,8 @@ public function __construct( $options=null ) {
12201220 $ this ->numLines = ErrorHandler::optionsPop ( $ options , 'snippet_num_lines ' , ErrorHandler::NUM_FILE_LINES );
12211221 $ this ->displayLineNumber = ErrorHandler::optionsPop ( $ options , 'display_line_numbers ' , false );
12221222
1223+ $ this ->htmlOnly = ErrorHandler::optionsPop ( $ options , 'html_only ' , true );
1224+
12231225 $ this ->classNotFoundException = null ;
12241226
12251227 $ wordpress = ErrorHandler::optionsPop ( $ options , 'wordpress ' , false );
@@ -1418,7 +1420,7 @@ private function endBuffer() {
14181420 if (
14191421 !$ this ->isAjax &&
14201422 $ this ->catchAjaxErrors &&
1421- ! ErrorHandler::isNonPHPRequest ()
1423+ (! $ this -> htmlOnly || ! ErrorHandler::isNonPHPRequest () )
14221424 ) {
14231425 $ content = ob_get_contents ();
14241426 $ handlers = ob_list_handlers ();
@@ -2279,6 +2281,7 @@ public function reportError( $code, $message, $errLine, $errFile, $ex=null ) {
22792281 $ _php_error_is_ini_enabled &&
22802282 $ this ->isOn () && (
22812283 $ this ->isAjax ||
2284+ !$ this ->htmlOnly ||
22822285 !ErrorHandler::isNonPHPRequest ()
22832286 )
22842287 ) {
@@ -3223,6 +3226,9 @@ function displayHTML( Closure $head, $body=null, $javascript=null ) {
32233226 ob_clean ();
32243227 } catch ( Exception $ ex ) { /* do nothing */ }
32253228
3229+ if (!$ this ->htmlOnly && ErrorHandler::isNonPHPRequest ()) {
3230+ header ( "Content-Type: text/html " );
3231+ }
32263232 header ( ErrorHandler::PHP_ERROR_MAGIC_HEADER_KEY . ': ' . ErrorHandler::PHP_ERROR_MAGIC_HEADER_VALUE );
32273233
32283234 echo '<!DOCTYPE html> ' ;
0 commit comments