Log the reason why revision->getContent() returns null
authorStephane Bisson <sbisson@wikimedia.org>
Thu, 18 Jan 2018 20:09:59 +0000 (15:09 -0500)
committerStephane Bisson <sbisson@wikimedia.org>
Tue, 23 Jan 2018 21:41:04 +0000 (13:41 -0800)
In the context of WikiPage->doEditUpdates(), when $revision->getContent()
returns null, $this->prepareContentForEdit() fails because it expects
something that implements 'Content' as its first argument but null is given.

This problem happens during Flow beta feature opt-out. I hope
this logging is not too spammy and helps shed light on the Flow
problem.

Bug: T184670
Change-Id: If06b8fda3657cae2eb23821f35e5b87919ceb615

includes/Revision.php

index 510c1ee..ffcb8b4 100644 (file)
@@ -890,6 +890,11 @@ class Revision implements IDBAccessObject {
                        return $this->mRecord->getContent( 'main', $audience, $user );
                }
                catch ( RevisionAccessException $e ) {
+                       wfDebugLog(
+                               'T184670',
+                               __METHOD__ . ": Cannot get content: " . $e->getMessage() .
+                               "\n" . $e->getTraceAsString()
+                       );
                        return null;
                }
        }