Page MenuHomePhabricator

Installer: Fail gracefully when XML requisites are not met (currently only a blank page in browser)
Open, MediumPublic

Description

I haven't tested it yet, but it seems that the installer borks with a fatal error if PHP has no DOM-XML support (see URL for a report in the support forum).

It should fail more gracefully, giving a more human-readable error message.


Version: 1.22.0
Severity: major
URL: http://www.mediawiki.org/wiki/Thread:Project:Support_desk/Fatal_error_attempting_to_run_install
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=47564

Details

Reference
bz42205

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 1:12 AM
bzimport set Reference to bz42205.
bzimport added a subscriber: Unknown Object (MLST).

Confirmed the bug. If the DOM functions aren't installed in php, then it throws a fatal error:

Fatal error: Class 'DOMDocument' not found in /var/www/html/wiki/includes/LocalisationCache.php on line 542

Tested with a fresh 1.20.0 installation.

The main page that displays the "setup the wiki first" doesn't throw any error. I don't know if it's possible to catch this error from the installer before loading the localisation cache.

Still valid in git master of today.

Steps to reproduce:

  1. Fedora 18
  2. Make sure that php-xml is NOT installed.
  3. Install MediaWiki
  4. Go to http://localhost/mediawiki/
  5. Click "set up the wiki"

Actual outcome:
A blank page. Confusion.

Expected outcome:
Some error message in the browser.

Other comments:

Looking at /var/log/httpd/error_log I see:

PHP Fatal error: Class 'DOMDocument' not found in /var/www/html/mediawiki/includes/cache/LocalisationCache.php on line 587, referer: http://localhost/mediawiki/

Confirming that after installing php-xml in Fedora via

yum install php-xml

and running

apachectl restart

and now having

php-xml.i686 0:5.4.14-1.fc18

installed, this problem does not happen anymore.

So my naive idea was to change envCheckXML() in /includes/installer/Installer.php from

if ( !function_exists( "utf8_encode" ) )

to

if ( !function_exists( 'utf8_encode' ) || !class_exists( 'DOMDocument' ) )

only to realize that these checks are only run *after* the Language setting dialog which is of course too late, as MediaWiki has already failed silently.

I assume environment checks are only done after the language dialog in order to present that page in the prefered language of the user?

  • Bug 51042 has been marked as a duplicate of this bug. ***

Change 76663 had a related patch set uploaded by MarkAHershberger:
Install without XML support

https://gerrit.wikimedia.org/r/76663

Should probably get Niklas or Siebrand to look at this patch.

(In reply to comment #7)

Should probably get Niklas or Siebrand to look at this patch.

hexmode: Siebrand gave a +1 on the patch.

Change 76663 abandoned by Hashar:
Install without XML support

Reason:
Abandoning for now. As I commented previously, I dont like adding yet another serialized file + bunch of code as a workaround for third parties not having the PHP extension XML.

https://gerrit.wikimedia.org/r/76663

Aklapper lowered the priority of this task from High to Medium.Sep 1 2015, 12:16 PM
Aklapper subscribed.

Someone may need to test it (maybe myself if I have time) but this one may be resolved with rMW41d1fa1c3aa9d6e9e0e5f0c5455b9092833e9012