Skip to content

Anbu html outputs before any other output, including headers #32

@nned

Description

@nned

Maybe I am doing something wrong?
In my case Anbu html code is outputing before even < html > tag -- i.e before any ouput from templates.
Which totally screws all session handling.

I wasted 4 hours trying to understand why auth suddenly stopped working - the answer was due to output before headers, cookies were not properly set, and new session was regenerated every page reload.

UPD: Code outputted is from view 'anbu::button'. It is echoed in anbu/src/Profiler.php @213
Maybe this hook 'executeAfterHook' is not hooked up properly?

public function executeAfterHook($request, $response)
{
// If the profiler is disabled...
if (!$this->enabled) {

        // Exit, we don't want to log requests to the profiler.
        return;
    }

    // Execute the after hook for each module.
    $this->executeModuleAfterHooks($request, $response);

    // Store the module and return it.
    $storage = $this->storeModuleData();

    // Get content type header.
    $type = $response->headers->get('Content-Type');

    // Check for JSON in the header.
    if (strstr($type, 'text/html') && $this->display) {

        // Get the view component.
        $view = $this->app->make('view');

        // Append button to response.
       echo $view->make('anbu::button', compact('storage'));  # <============
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions