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

Output buffering to avoid failing session_start in PHP 7.1 #146

Merged
merged 3 commits into from Sep 1, 2017

Conversation

plewin
Copy link
Member

@plewin plewin commented Aug 31, 2017

Implements ob_start / ob_end_flush as discussed in #128

Revert "output_buffering" for php.ini because it is no longer needed.

Also remove redundant closing php tags to avoid outputing unintentionally white spaces

@coudot coudot added the bug label Aug 31, 2017
@coudot coudot added this to the 1.1 milestone Aug 31, 2017
Copy link
Member

@coudot coudot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why we need to remove all these closing tags, it is a little weird to have these PHP files with just an opening tag and no closing tag. Are you sure we can't do otherwise?

Does it not work if we simply add a close tag after ob_end_flush() in index.php?

@plewin
Copy link
Member Author

plewin commented Aug 31, 2017

It is a good practice (i agree, sometimes questionned), actually it is not necessary because I added the ob_start before the includes().

There is no problem if there is close tag after ob_end_flush() but it is the only file I'm okay with. Other files are better without the risk of unwanted whitespaces that may cause problems in future unit tests.

If a file is pure PHP code, it is preferable to omit the PHP closing tag at the end of the file. This prevents accidental whitespace or new lines being added after the PHP closing tag, which may cause unwanted effects because PHP will start output buffering when there is no intention from the programmer to send any output at that point in the script.
https://secure.php.net/manual/en/language.basic-syntax.phptags.php

@coudot
Copy link
Member

coudot commented Sep 1, 2017

Ok I did not know that!

I will merge this PR and close all issues related to 1.1. We can know release this version.

Thanks a lot for this work!

@coudot coudot merged commit cff9035 into ltb-project:master Sep 1, 2017
@plewin plewin deleted the output_buffering branch September 1, 2017 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants