diff options
| author | Bert Koorengevel <BertKoor@users.noreply.github.com> | 2026-03-08 10:54:09 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-08 09:54:09 +0000 |
| commit | 0d848f7a128638f9dff7e123b6c0b1a7a3e37357 (patch) | |
| tree | 318f2bfa973449179fba50c809181da9257109e8 | |
| parent | c40a98173f941136d8fc32bd27b9f9859ae8f443 (diff) | |
| download | webtrees-0d848f7a128638f9dff7e123b6c0b1a7a3e37357.tar.gz webtrees-0d848f7a128638f9dff7e123b6c0b1a7a3e37357.tar.bz2 webtrees-0d848f7a128638f9dff7e123b6c0b1a7a3e37357.zip | |
phpinfo() not always returns a proper body (#5324)
* phpinfo() not always returns a proper body
* Add comment
---------
Co-authored-by: Greg Roach <greg@subaqua.co.uk>
| -rw-r--r-- | app/Http/RequestHandlers/PhpInformation.php | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/app/Http/RequestHandlers/PhpInformation.php b/app/Http/RequestHandlers/PhpInformation.php index 143ea86e60..5cceecc380 100644 --- a/app/Http/RequestHandlers/PhpInformation.php +++ b/app/Http/RequestHandlers/PhpInformation.php @@ -45,8 +45,12 @@ final class PhpInformation implements RequestHandlerInterface ob_start(); phpinfo(INFO_ALL & ~INFO_CREDITS & ~INFO_LICENSE); $phpinfo = ob_get_clean(); - preg_match('%<body>(.*)</body>%s', $phpinfo, $matches); - $phpinfo = $matches[1]; + if (preg_match('%<body>(.*)</body>%s', $phpinfo, $matches)) { + $phpinfo = $matches[1]; + } else { + // Some web hosts use custom PHP builds with a non-standard phpinfo() + $phpinfo = '<pre>' . $phpinfo . '</pre>'; + } return $this->viewResponse('admin/server-information', [ 'title' => I18N::translate('Server information'), |
