Resolved: Mediawiki Undefined property: DatabaseMysql mTrxDoneWrites


If you’ve recently upgraded to MediaWiki 1.20 or later and you use MySQL (which most people seem to do since wikipedia uses it I guess?), you may see a mediawiki undefined property PHP Notice filling up your web server’s error log.

mediawiki logo with superimposed ninja

I’m using lighttpd with fastcgi and php 5.3.3 on CentOS 6.3 right now, and the error message was filling up lighttpd’s error log:

Depending on how much traffic your wiki sees, the error log can fill fairly quickly since every time a page loads, the message gets output into my log eight times in a row. It’s only a warning, but I don’t like it filling my logs. Off with it’s head!

2012-12-20 11:59:59: (mod_fastcgi.c.2701) FastCGI-stderr: PHP Notice: Undefined property: DatabaseMysql::$mTrxDoneWrites in /var/www/lighttpd/wiki/includes/db/Database.php on line 512

I looked in my older version of mediawiki’s Database.php and saw there’s a private $mTrxDoneWrites variable defined. In the current version it’s missing, but the public function writesOrCallbacksPending() is still there attempting to access it’s value.

Upon closer inspection, it seems it was always false anyway, and since it’s or’d with $this->mTrxIdleCallbacks, you can either define the TrxDoneWrites variable and set it to false, or just eliminate it from the function entirely.

I didn’t see that variable used anywhere else, so I removed it from the function. Everything appears to continue humming along smoothly for me.

Change this:

To this:

As always, this is my personal brain dump. Your mileage may vary. Follow in my footsteps at your own risk. Mediawiki undefined property solved! Good luck!



Leave a Reply

Your email address will not be published. Required fields are marked *


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">