LogFormatter: ignore unrecoverable data
authorStephane Bisson <sbisson@wikimedia.org>
Mon, 1 Apr 2019 14:42:57 +0000 (10:42 -0400)
committerStephane Bisson <sbisson@wikimedia.org>
Wed, 3 Apr 2019 12:50:15 +0000 (08:50 -0400)
It is possible for the log_params column of the logging
table to contain serialized data that cannot be deserialized
anymore because the types it references are missing.

It is currently the case with old Flow log entries on enwiki.
The extension is uninstalled and the UUID class is not found.

This patch proposes to simply skip the params and log a
warning in that case.

Bug: T212742
Change-Id: I3226b8fb338dd2b81e087af5d798d8f35368282d

includes/logging/LogFormatter.php

index 1f37a35..b9bb70c 100644 (file)
@@ -817,6 +817,11 @@ class LogFormatter {
                foreach ( $this->getParametersForApi() as $key => $value ) {
                        $vals = explode( ':', $key, 3 );
                        if ( count( $vals ) !== 3 ) {
+                               if ( $value instanceof __PHP_Incomplete_Class ) {
+                                       wfLogWarning( 'Log entry of type ' . $this->entry->getFullType() .
+                                               ' contains unrecoverable extra parameters.' );
+                                       continue;
+                               }
                                $logParams[$key] = $value;
                                continue;
                        }