Last modified: 2012-08-16 16:42:53 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 T41393, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 39393 - Math.php generates many "Constant already defined" error messages in apache2 logs
Math.php generates many "Constant already defined" error messages in apache2 ...
Status: RESOLVED INVALID
Product: MediaWiki extensions
Classification: Unclassified
Math (Other open bugs)
unspecified
PC Linux
: Unprioritized normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-08-15 20:30 UTC by kardos_42
Modified: 2012-08-16 16:42 UTC (History)
1 user (show)

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


Attachments

Description kardos_42 2012-08-15 20:30:43 UTC
Math.php generates a large number of errors in my /var/log/apache2/error.log file. For examples:

[Mon Aug 13 05:37:19 2012] [error] [client 12.34.56.78] PHP Notice:  Constant MW_MATH_SIMPLE already defined in /var/lib/mediawiki/extensions/Math/Math.php on line 33, referer: http://server.com/url/whatever.html
[Mon Aug 13 05:37:19 2012] [error] [client 12.34.56.78] PHP Notice:  Constant MW_MATH_HTML already defined in /var/lib/mediawiki/extensions/Math/Math.php on line 34, referer: http://server.com/url/whatever.html
[Mon Aug 13 05:37:19 2012] [error] [client 12.34.56.78] PHP Notice:  Constant MW_MATH_SOURCE already defined in /var/lib/mediawiki/extensions/Math/Math.php on line 35, referer: http://server.com/url/whatever.html
[Mon Aug 13 05:37:19 2012] [error] [client 12.34.56.78] PHP Notice:  Constant MW_MATH_MODERN already defined in /var/lib/mediawiki/extensions/Math/Math.php on line 36, referer: http://server.com/url/whatever.html
[Mon Aug 13 05:37:19 2012] [error] [client 12.34.56.78] PHP Notice:  Constant MW_MATH_MATHML already defined in /var/lib/mediawiki/extensions/Math/Math.php on line 37, referer: http://server.com/url/whatever.html


I'm far from a PHP expert, but I've modified Math.php to check if those constants are defined before defining them:

if(!defined('MW_MATH_PNG')) {
  define( 'MW_MATH_PNG',    0 );
}
if(!defined('MW_MATH_SIMPLE')) {
  define( 'MW_MATH_SIMPLE', 1 );
}
if(!defined('MW_MATH_HTML')) {
  define( 'MW_MATH_HTML',   2 );
}
if(!defined('MW_MATH_SOURCE')) {
  define( 'MW_MATH_SOURCE', 3 );
}
if(!defined('MW_MATH_MODERN')) {
  define( 'MW_MATH_MODERN', 4 );
}
if(!defined('MW_MATH_MATHML')) {
  define( 'MW_MATH_MATHML', 5 );
}

The above change suppresses the errors in my apache error.log and my wiki pages still display math correctly. Can someone review and include this change in the git repo if appropriate?

Math plugin: version 1.0
Media wiki: 1:1.15.1-1ubuntu2.1 (mediawiki)
Comment 1 Sam Reed (reedy) 2012-08-16 16:42:53 UTC
Math wasn't removed from core till 1.18, so of course these errors are going to occur when you have "math" in core, and a newer Math extension. They're not designed to be used on the same wiki at the same time.

Please note you are running a version of MediaWiki with known security issues, as well as it not being supported for further security updates and bugfixes [1]


[1] https://www.mediawiki.org/wiki/Version_lifecycle

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


Navigation
Links