Skip to content

Commit

Permalink
Don't bother trying to set headers if not possible.
Browse files Browse the repository at this point in the history
We often get error log reports with messages like the following:
```
PHP Warning:  Cannot modify header information - headers already sent by (output started at /opt/xdmod/share/html/index.php:180) in /opt/xdmod/share/configuration/linker.php on line 179
```

These are of course completely useless and are caused by the error
handler trying to set the headers and failing. The issue is that the
orignal message that the error handler is supposed to output does not
make it to the logs.

This change ensures that the exception handler only tries to set headers
if they have not already been sent and updates the documentation to
encourage folk to look in the xdmod exceptions log.
  • Loading branch information
jpwhite4 committed Dec 19, 2019
1 parent 47f6f18 commit 74f19d0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion configuration/linker.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ function global_uncaught_exception_handler($exception)
$exceptionOutput = handle_uncaught_exception($exception);

// If running in a server context...
if ($exceptionOutput['isServerContext']) {
if ($exceptionOutput['isServerContext'] && !headers_sent()) {
// Set the exception's headers (if any).
foreach ($exceptionOutput['headers'] as $headerKey => $headerValue) {
header("$headerKey: $headerValue");
Expand Down
4 changes: 4 additions & 0 deletions docs/support.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,13 @@ Email `ccr-xdmod-help` at `buffalo.edu` for support. Please include the followi
- The output of `xdmod-check-config`
- PHP and MySQL version (e.g, the output from `php --version`, `mysql --version`, and the SQL command `SHOW VARIABLES LIKE "%version%";`)
- The output of `php -i`
- Any messages in the XDMoD exceptions log `/var/log/xdmod/exceptions.log`
- A description of the problem you are experiencing
- Detailed steps to reproduce the problem

If the problem is observed when trying to access the web portal then please also include any
messages in the web server error log `/var/log/xdmod/apache-error.log`

Mailing List
------------

Expand Down

0 comments on commit 74f19d0

Please # to comment.