https://bugzilla.wikimedia.org/show_bug.cgi?id=39393

       Web browser: ---
             Bug #: 39393
           Summary: Math.php generates many "Constant already defined"
                    error messages in apache2 logs
           Product: MediaWiki extensions
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: Unprioritized
         Component: Math
        AssignedTo: [email protected]
        ReportedBy: [email protected]
    Classification: Unclassified
   Mobile Platform: ---


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)

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to