Framework: [BUG] Removing whitespace before DOCTYPE

Created on 14 Oct 2013  路  2Comments  路  Source: laravel/framework

There鈥檚 an issue I鈥檓 having on a few applications which is similar to a bug from Laravel 3 #1242. I鈥檓 using the Blade @extends syntax and due to the linebreak and white space, it鈥檚 creating linebreaks between the DOCTYPE and the top of the HTML.

@extends('layout')

@section('content')
    <h1>My Content</h1>
@stop

This produces the following HTML:

<!DOCTYPE html>
<html>
    <head>
...

Notice the linebreak before the DOCTYPE, which is a Bad Thing.

Also, it is preferable to leave a new line at the end of each file for Git, but even omitting this you still can鈥檛 leave any whitespace between sections for readability.

Most helpful comment

Sorry for replying in this old post, but I can't comment on this issue:
https://github.com/laravel/framework/pull/2478

Recently I got this strange issue with output buffer.

I'm doing some xml responses and this gave me huge headache with this extra whitespaces.

I tried dropping some ob_end_clean() before returning responses, and it works.

All 2 comments

I鈥檝e made a suggestion to what could solve this problem #2478!

Sorry for replying in this old post, but I can't comment on this issue:
https://github.com/laravel/framework/pull/2478

Recently I got this strange issue with output buffer.

I'm doing some xml responses and this gave me huge headache with this extra whitespaces.

I tried dropping some ob_end_clean() before returning responses, and it works.

Was this page helpful?
0 / 5 - 0 ratings