Page MenuHomePhabricator

Special:CheckUser causes errors with PostgreSQL
Closed, ResolvedPublic

Description

Using Special:CheckUser's "Account Edits" or "Get edits from IP" options with a database that uses real timestamps (e.g. PostgreSQL) causes a number of errors similar to the following to be output:

Notice: Undefined offset: -2 in /usr/local/src/MediaWiki/phase3/languages/Language.php on line 423

Notice: Undefined offset: -1 in /usr/local/src/MediaWiki/phase3/languages/Language.php on line 423

Language::sprintfDate and Language::timeanddate both expect a YYYYMMDDHHMMSS format timestamp, but CheckUser_body.php is passing it whatever is returned from the database. One possible fix is to run any timestamps retrieved from the database through wfTimestamp() (with the TS_MW option) before passing them to these functions.

Also, using any of the Duration options besides "all" causes a database error, as PostgreSQL does not recognize the "YYYYMMDDHHMMSS" format as a valid input format for timestamps. The fix here seems to be to use the $dbr->timestamp() method to convert the timestamp into the appropriate format for the database before using it in the SQL query.

All of this was tested using a local installation of MediaWiki r41664, the CheckUser extension as of r41664, and PostgreSQL 8.3.4.


Version: unspecified
Severity: normal

Details

Reference
bz15833

Related Objects

View Standalone Graph
This task is connected to more than 200 other tasks. Only direct parents and subtasks are shown here. Use View Standalone Graph to show more of the graph.
StatusSubtypeAssignedTask
InvalidNone
Resolvedaaron

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:22 PM
bzimport added a project: CheckUser.
bzimport set Reference to bz15833.

Created attachment 5388
Patch for the three remaining errors in r41668

Three timestamps were missed in r41668. This patch fixes them in the same style as r41668.

Attached:

Jdforrester-WMF subscribed.

Migrating from the old tracking task to a tag for PostgreSQL-related tasks.