Page MenuHomePhabricator

LocalSettings.php contains strange caracters, produces strange error message
Closed, ResolvedPublic

Description

Author: olivier.cailloux

Description:
I somehow introduced, when editing (using MS Wordpad or Notepad) or uploading (through ftp) my LocalSettings.php file, strange characters in the beginning of the file. Invisible in the editor (because not displayable), these characters (0xEF BB BF) caused the wiki to not function properly.

MediaWiki would be easier to use if it would display a proper error message (something like: 'illegal character in the LocalSettings.php file'). Instead of which, my MediaWiki software was displaying an empty page instead of the "welcome" page, was talking about some problem with cookies after an editing, ... The strangest thing is that some functionnalities and some pages where working correctly, and others not. It took me a while to discover the source of the problem.

That mediawiki software was pretty old, but I checked by uploading the problematic LocalSettings.php file to a newer MediaWiki installation and the behavior is strange also (there it says something like it cannot add the required header settings).

I think that this is a bug because, as far as I understand the concept of a php-file, the beginning of the file (which was before the <?php entry) should act as if it was normal HTML. Then some strange hex characters should not break the entire application, but should rather (at worst) cause some strange characters to be displayed in some pages. If the LocalSettings.php file is supposed to begin with <?php, then it is easy to check that before parsing the rest of the file and display a proper error message... It would save time for administrators.

I'm sorry, I don't know how to check the version number, but the second version is recent (stable version from about one month ago).

Thank you.


Version: unspecified
Severity: minor

Details

Reference
bz10371

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:52 PM
bzimport set Reference to bz10371.
bzimport added a subscriber: Unknown Object (MLST).

(In reply to comment #0)

I'm sorry, I don't know how to check the version number, but the second version
is recent (stable version from about one month ago).

Your version number can be found on the Special:Version page. As for the rest of this bug, I haven't the slightest idea, sorry.

Your editor has inserted a BOM - Byte-order mark, see http://en.wikipedia.org/wiki/Byte_Order_Mark

This is not a special MediWiki issue.

olivier.cailloux wrote:

Thanks for replying. I don't agree with the status RESOLVED, or INVALID. I don't see why MediaWiki should react like this when he encounters a BOM in a config file.

Please read my entire post, and in particular (but not only): "MediaWiki would be easier to use if it would display a proper error message (something like: 'illegal character in the LocalSettings.php file')".

If not a special MediaWiki issue, then who can change this behavior?

It's an issue with how PHP handles files which are encoded in this way. See bug 9954 for a recommendation on detecting the condition.

  • This bug has been marked as a duplicate of bug 9954 ***

olivier.cailloux wrote:

Ok thanks for the info guys. Keep up the good work.