Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

andyandy's avatar

Laravel dumping HTML into error log

Instead of logging simple error, Laravel is dumping huge HTML codes into log file (assuming its a HTML code of Exception View?).

This is single error, has 33 000+ lines.

[2021-11-29 16:45:32] production.ERROR: syntax error, unexpected 'version' (T_STRING) (View: /home/www/resources/views/svg/move.blade.php) {"view":"data":{"system_version":"<pre class=sf-dump id=sf-dump-167097926 data-indent-pad=\"  \"><span class=sf-dump-num>30</span>
</pre><script>Sfdump(\"sf-dump-167097926\", {\"maxDepth\":3,\"maxStringLength\":160})</script>
","hasHeaderAlert":"<pre class=sf-dump id=sf-dump-827947783 data-indent-pad=\"  \"><span class=sf-dump-const>true</span>
</pre><script>Sfdump(\"sf-dump-827947783\", {\"maxDepth\":3,\"maxStringLength\":160})</script>
","popup":"<pre class=sf-dump id=sf-dump-1604149286 data-indent-pad=\"  \"><span class=sf-dump-note>App\Models\Popup</span> {<a class=sf-dump-ref>#1563</a><samp data-depth=1 class=sf-dump-expanded>
  +<span class=sf-dump-public title=\"Public property\">table</span>: \"<span class=sf-dump-str title=\"6 characters\">popups</span>\"
  +<span class=sf-dump-public title=\"Public property\">timestamps</span>: <span class=sf-dump-const>false</span>
  #<span class=sf-dump-protected title=\"Protected property\">connection</span>: \"<span class=sf-dump-str title=\"5 characters\">mysql</span>\"
  #<span class=sf-dump-protected title=\"Protected property\">primaryKey</span>: \"<span class=sf-dump-str title=\"2 characters\">id</span>\"
  #<span class=sf-dump-protected title=\"Protected property\">keyType</span>: \"<span class=sf-dump-str title=\"3 characters\">int</span>\"
  +<span class=sf-dump-public title=\"Public property\">incrementing</span>: <span class=sf-dump-const>true</span>
  #<span class=sf-dump-protected title=\"Protected property\">with</span>: []
  #<span class=sf-dump-protected title=\"Protected property\">withCount</span>: []
  #<span class=sf-dump-protected title=\"Protected property\">perPage</span>: <span class=sf-dump-num>15</span>
  +<span class=sf-dump-public title=\"Public property\">exists</span>: <span class=sf-dump-const>true</span>
  +<span class=sf-dump-public title=\"Public property\">wasRecentlyCreated</span>: <span class=sf-dump-const>false</span>
  #<span class=sf-dump-protected title=\"Protected property\">attributes</span>: <span class=sf-dump-note>array:3</span> [<samp data-depth=2 class=sf-dump-compact>
    \"<span class=sf-dump-key>id</span>\" => <span class=sf-dump-num>1</span>
    \"<span class=sf-dump-key>part1</span>\" => \"\"
    \"<span class=sf-dump-key>part2</span>\" => \"<span class=sf-dump-str title=\"184 characters\"></span>\"
  </samp>]
  #<span class=sf-dump-protected title=\"Protected property\">changes</span>: []
  #<span class=sf-dump-protected title=\"Protected property\">casts</span>: []
  #<span class=sf-dump-protected title=\"Protected property\">classCastCache</span>: []
  #<span class=sf-dump-protected title=\"Protected property\">dates</span>: []
  #<span class=sf-dump-protected title=\"Protected property\">dateFormat</span>: <span class=sf-dump-const>null</span>
  #<span class=sf-dump-protected title=\"Protected property\">appends</span>: []
  #<span class=sf-dump-protected title=\"Protected property\">dispatchesEvents</span>: []
  #<span class=sf-dump-protected title=\"Protected property\">observables</span>: []
  #<span class=sf-dump-protected title=\"Protected property\">relations</span>: []
  #<span class=sf-dump-protected title=\"Protected property\">touches</span>: []
  #<span class=sf-dump-protected title=\"Protected property\">hidden</span>: []
  #<span class=sf-dump-protected title=\"Protected property\">visible</span>: []
0 likes
11 replies
lbecket's avatar

The first line seems sufficient for diagnosing the error.

Tray2's avatar

It dumps the whole view. and like @lbecket says, read the first line.

Sinnbeck's avatar

The 300 lines of code looks like a dump()/dd()

andyandy's avatar

@lbecket @tray2 @sinnbeck

I know that first line is enough to fix the current problem. But that is not the problem. I want Laravel to stop dumping 30 000+ lines into LOG whenever there is some issue.

I have searched entire project for "dd(" or "dump(" and there is nothing.

Sinnbeck's avatar

Are you certain that you dont have dump or dd inside the app\Exceptions directory somewhere?

andyandy's avatar

App\Exceptions\Handler.php

<?php

namespace App\Exceptions;

use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;

class Handler extends ExceptionHandler
{
    /**
     * A list of the exception types that are not reported.
     *
     * @var array
     */
    protected $dontReport = [
        //
    ];

    /**
     * A list of the inputs that are never flashed for validation exceptions.
     *
     * @var array
     */
    protected $dontFlash = [
        'current_password',
        'password',
        'password_confirmation',
    ];

    /**
     * Register the exception handling callbacks for the application.
     *
     * @return void
     */
    public function register()
    {
        $this->reportable(function (Throwable $e) {
            //
        });
    }
}

tnfsam's avatar

Hey did you find a solution to this? I have the same problem. For me it began when I switched out the main app default Docker container for a home-made one (still using Sail but docker-compose.yml edited for new main container).

1 like
janise's avatar

Yes, what's the solution? I installed some Dockerized sample Laravel set-up, and for each error I get that one useful first line, and then 600 unreadable HTML marked-up lines (why is it marked for the console error log?).

dpacmittal's avatar

For anyone reaching here from Google search, like I did, the solution that worked for me was to not install dev packages in production.

Remove your existing vendor dir and run:

composer install --prefer-dist --no-dev -o

That should skip the ignition package and will stop dumping html in your logs.

ubedthaheem's avatar

I think error logging code is wrapped in JSON format, like JSON_ENCODE($throwableResponse)

Please or to participate in this conversation.