diff --git a/pinc/html_page_common.inc b/pinc/html_page_common.inc index 4bd61d843..0acdf3526 100644 --- a/pinc/html_page_common.inc +++ b/pinc/html_page_common.inc @@ -19,11 +19,13 @@ function output_html_header(?string $nameofpage, array $extra_args = [], bool $s { global $code_url; - static $was_output = false; - if ($was_output) { + static $output_caller = null; + if (!is_null($output_caller)) { + $loc = get_backtrace_loc(); + error_log("output_html_header: called from $output_caller then $loc"); return; } - $was_output = true; + $output_caller = get_backtrace_loc(); $user = User::load_current(); diff --git a/pinc/slim_header.inc b/pinc/slim_header.inc index c01e7ca6c..cba1fcccb 100644 --- a/pinc/slim_header.inc +++ b/pinc/slim_header.inc @@ -34,12 +34,14 @@ function slim_footer(array $extra_args = []): void { // Despite not needing to, some pages may still be calling slim_footer // so check to see if we've already output the footer. - static $was_output = false; - if ($was_output) { + static $output_caller = null; + if (!is_null($output_caller)) { + $loc = get_backtrace_loc(); + error_log("slim_footer: called from $output_caller then $loc"); return; } output_html_footer($extra_args); - $was_output = true; + $output_caller = get_backtrace_loc(); } diff --git a/tools/project_manager/generate_post_files.php b/tools/project_manager/generate_post_files.php index 40331f2c5..f05993b20 100644 --- a/tools/project_manager/generate_post_files.php +++ b/tools/project_manager/generate_post_files.php @@ -67,11 +67,13 @@ function output_page_header(Project $project): void // Allow this function to be called multiple times but only output // the contents once. - static $was_output = false; - if ($was_output) { + static $output_caller = null; + if (!is_null($output_caller)) { + $loc = get_backtrace_loc(); + error_log("output_page_header: called from $output_caller then $loc"); return; } - $was_output = true; + $output_caller = get_backtrace_loc(); $title = _("Generating Post Files"); slim_header($title);