Skip to content

Commit

Permalink
(base) Give a hint in web interface if SimpleXML (php-xml) is missing
Browse files Browse the repository at this point in the history
Fixes #2180
And prevents #31473, #23970, #18610, #15708

Avoids a 500 error and also gives a useful error message on the web interface if this module isn't installed, gets overlooked during a PHP upgrade, etc.

While we check for it later, it's too late for session.

Inspired by #17163

Signed-off-by: Josh Richards <[email protected]>
  • Loading branch information
joshtrichards authored and skjnldsv committed Aug 16, 2024
1 parent 75180a6 commit 8032b6a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,13 @@ public static function init(): void {
$bootstrapCoordinator->runInitialRegistration();

$eventLogger->start('init_session', 'Initialize session');

// Check for PHP SimpleXML extension earlier since we need it before our other checks and want to provide a useful hint for web users
// see https://github.com/nextcloud/server/pull/2619
if (!function_exists('simplexml_load_file')) {
throw new \OCP\HintException('The PHP SimpleXML/PHP-XML extension is not installed.', 'Install the extension or make sure it is enabled.');
}

OC_App::loadApps(['session']);
if (!self::$CLI) {
self::initSession();
Expand Down

0 comments on commit 8032b6a

Please sign in to comment.