简体   繁体   中英

Output buffer vulnerabilities PHP

What are the vulnerabilities of output buffer functions in PHP?

  • Not saying it has vulnerabilities, merely wondering if there were any

Why is it considered ugly php code?

Output buffering is considered ugly if it is used to circumvent ye' olde Cannot send headers, output already started at... warning. Output buffering is then used to make up for poor design.

In a well designed application you would make sure that any response headers are sent first before any response body content is output, without having to resort to output buffering.

In an application which is made up of spaghetti code , a developer might make the decision to cram another header in somewhere, after body content has already been output. And since http headers must be sent before http body content, they use output buffering to tackle this violation of the http protocol. I've explained this more elaborate a while ago in this answer .

It's actually a very helpful tool as explained in the article below...

http://dev-tips.com/featured/output-buffering-for-web-developers-a-beginners-guide

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM