Skip to content

Commit

Permalink
Check if headers are empty and then flush and get the headers again
Browse files Browse the repository at this point in the history
In #127 flush() was removed but a comment on apache_response_headers()
said that function may return an empty array, so I check for that here
and do a flush() before getting the headers again.
  • Loading branch information
donnchawp committed Feb 3, 2017
1 parent 67c53e9 commit 8349ab7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions wp-cache-phase2.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ function wp_cache_user_agent_is_rejected() {
function wp_cache_get_response_headers() {
if(function_exists('apache_response_headers')) {
$headers = apache_response_headers();
if ( empty( $headers ) ) {
flush();
$headers = apache_response_headers();
}
} else if(function_exists('headers_list')) {
$headers = array();
foreach(headers_list() as $hdr) {
Expand Down

0 comments on commit 8349ab7

Please sign in to comment.