Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect Content-Lenght after toolbar injection #18

Closed
weierophinney opened this issue Dec 31, 2019 · 1 comment
Closed

Incorrect Content-Lenght after toolbar injection #18

weierophinney opened this issue Dec 31, 2019 · 1 comment

Comments

@weierophinney
Copy link
Member

When the Content-Lenght is set by some module for an text/html asset (think asset manager for static html files in a data directory served via standard resolver :-) ) the Content-Lenght header will be incorrect after the Toolbar is injected. This results pages in half loaded.

adding the following at https://github.com/zendframework/ZendDeveloperTools/blob/master/src/ZendDeveloperTools/Listener/ToolbarListener.php#L163 will solve this

    if (function_exists('mb_strlen')) {
        $contentLength = mb_strlen($injected, '8bit');
    } else {
        $contentLength = strlen($injected);
    }

    $response->getHeaders()
        ->addHeaderLine('Content-Transfer-Encoding',   'binary')
        ->addHeaderLine('Content-Length',              $contentLength);

I don't actually need the toolbar on static pages, and i realize this only affects development environments, still I though "lets create a record of this...".

I also wonder why the Response object does not do this automatically...


Originally posted by @basz at zendframework/zend-developer-tools#119

@samsonasik
Copy link
Member

The code is now totally different with the code you pointed. I'm going to close it. Please re-create issue if the problem persist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants