anbu icon indicating copy to clipboard operation
anbu copied to clipboard

Anbu html outputs before any other output, including headers

Open nned opened this issue 11 years ago • 1 comments

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'));  # <============
    }
}

nned avatar Dec 07 '14 19:12 nned

This should be fixed on dev master already.

barryvdh avatar Dec 07 '14 21:12 barryvdh