From 0d848f7a128638f9dff7e123b6c0b1a7a3e37357 Mon Sep 17 00:00:00 2001 From: Bert Koorengevel Date: Sun, 8 Mar 2026 10:54:09 +0100 Subject: phpinfo() not always returns a proper body (#5324) * phpinfo() not always returns a proper body * Add comment --------- Co-authored-by: Greg Roach --- app/Http/RequestHandlers/PhpInformation.php | 8 ++++++-- 1 file 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('%(.*)%s', $phpinfo, $matches); - $phpinfo = $matches[1]; + if (preg_match('%(.*)%s', $phpinfo, $matches)) { + $phpinfo = $matches[1]; + } else { + // Some web hosts use custom PHP builds with a non-standard phpinfo() + $phpinfo = '
' . $phpinfo . '
'; + } return $this->viewResponse('admin/server-information', [ 'title' => I18N::translate('Server information'), -- cgit v1.3