Monday, 9 January 2017

What PHP Functions Create Output?



Has anyone ever compiled a list of all the PHP functions/methods that send output to the browser (or STDOUT when running in CLI mode)? A quick search didn't show any manual pages with this information (but I could be wrong there)




I'm interested in functions that are designed to do this, not functions that may raise warnings that would be sent directly to the browser.



The print and echo functions are the obvious ones, I'm looking for a list of lesser known output functions, like readfile.



The main reason I'm asking the question is I'd like a list of functions to check for when tracking down "early output" style errors. (headers can't be set, etc.)


Answer



Expanding list:



printf

vprintf
var_export
passthru
gzpassthru
fpassthru
debug_print_backtrace


[+] they are rather obvoius but also worth mentioning:




flush
ob_flush
ob_end_flush


And header related functions also produces output, I remember having to run php-cgi, when CLI binary was not available, and there it was especially annoying



header
setcookie
session_start /* with sessions that uses cookie */


No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...