Last modified: 2011-12-14 13:39:14 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T34322, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 32322 - Undefined index "HTTP_USER_AGENT" causes PHP notice in maintenance scripts
Undefined index "HTTP_USER_AGENT" causes PHP notice in maintenance scripts
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
FCKeditor (Other open bugs)
unspecified
All All
: Unprioritized normal (vote)
: ---
Assigned To: Nobody - You can work on this!
: patch, patch-need-review
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-11-09 19:27 UTC by Joerg
Modified: 2011-12-14 13:39 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Patch for the issue (600 bytes, patch)
2011-11-09 19:28 UTC, Joerg
Details

Description Joerg 2011-11-09 19:27:24 UTC
Having FCKeditor installed, I get the following notice when I run the maintenance scripts:

Notice: Undefined index: HTTP_USER_AGENT in extensions\FCKeditor\fckeditor\fckeditor_php5.php on line 37

The file in question attempts to access $_SERVER['HTTP_USER_AGENT'] which is not set in command line mode.

People have already asked for a fix in CKEditor itself, however the CKEditor guys say they will not fix this issue. See http://dev.ckeditor.com/ticket/6279

I see no reason for FCKeditor to be loaded when running command line php scripts for mediawiki maintenance. 
I propose to fix the issue in the MediaWiki extension by adding an early return, if we are in command line mode:

At the beginning of FCKeditor\FCKeditor.php:
<code>
// There is no reason for FCKeditor to run in commandline mode.
// Returning avoids breakage of scripts like dumpBackup.php.
if ( isset($wgCommandLineMode) && $wgCommandLineMode )
{
    return; // Simply return from the include, so no FCKeditor code is run
}
</code>

I am running MediaWiki 1.17 and the according released version of FCKeditor.
Comment 1 Joerg 2011-11-09 19:28:52 UTC
Created attachment 9404 [details]
Patch for the issue

I attached the patch.
Comment 2 Sumana Harihareswara 2011-12-01 21:50:02 UTC
Joerg, just a quick question, does the problem still happen with MediaWiki 1.18?
Comment 3 Joerg 2011-12-11 14:18:59 UTC
Hi sumanah,

thanks for the question. I was not yet able to install 1.18 to test this. I hope that other work in my wiki is completed during this week and that I can install 1.18 next weekend. I will definitely keep you updated here.
Comment 4 Brion Vibber 2011-12-13 23:23:50 UTC
Shouldn't make a difference between 1.18 and earlier since it's a bug in the FCKEditor low-level classes, it looks like.

These really shouldn't be getting invoked unless the editor is in use, though.... but I don't really want to mess around with its internals. ;)
Comment 5 Brion Vibber 2011-12-13 23:30:01 UTC
Ok looks like the loader code is doing this:

  // Initialize FCKeditor and the MediaWiki extension
  $fckeditor = new FCKeditor('fake');
  $wgFCKEditorIsCompatible = $fckeditor->IsCompatible();

so...... that kinda defeats the purpose of a loader script not being supposed to execute stuff that might not work. ;)

Lemme see if we can disable that....

r106129 should do the job, seems to work for my testing. Joerg, can you confirm?
Comment 6 Joerg 2011-12-14 13:39:14 UTC
Hi Brion,

yes, your patch solves the issue as well! Thank you! :-)

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links