Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

getTraceAsString() printing out as one whole line

I am using the php method getTraceAsString() which will pring out my error messages like:

#0 /var/www/wordpress/wp-content/themes/Aisis-Framework/AisisCore/Template/Builder.php(147): AisisCore_Template_Builder->_render_template_array(Array, 'navigation') #1 /var/www/wordpress/wp-content/themes/Aisis-Framework/index.php(3): AisisCore_Template_Builder->render_view('navigation') #2 /var/www/wordpress/wp-includes/template-loader.php(47): include('/var/www/wordpr...') #3 /var/www/wordpress/wp-blog-header.php(16): require_once('/var/www/wordpr...') #4 /var/www/wordpress/index.php(17): require('/var/www/wordpr...') #5 {main}

As you can see is one giant string. The example they gave prints out the trace as separate lines. is there something I have to do to get that?

like image 744
TheWebs Avatar asked Jan 14 '23 03:01

TheWebs


1 Answers

It's a string with line breaks, not HTML. Look at the source code of your page.

Either wrap the output in <pre></pre> tags or replace the line break with HTML line breaks.

preg_replace("/\n/", '<br>', $trace);
like image 141
Sammitch Avatar answered Jan 21 '23 05:01

Sammitch