jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/386048 )
Change subject: Treat NULL and 0 as equivalent for rev_parent_id ...................................................................... Treat NULL and 0 as equivalent for rev_parent_id The return value of Revision::getParentId is under-specified. Calling code should treat null and 0 as equivalent. Change-Id: Ia4e281c6b499441803b581ba81d3211e1a09789a --- M client/includes/RecentChanges/RevisionData.php M repo/Wikibase.hooks.php 2 files changed, 13 insertions(+), 4 deletions(-) Approvals: Ladsgroup: Looks good to me, approved jenkins-bot: Verified diff --git a/client/includes/RecentChanges/RevisionData.php b/client/includes/RecentChanges/RevisionData.php index 48ab89d..7ab6d63 100644 --- a/client/includes/RecentChanges/RevisionData.php +++ b/client/includes/RecentChanges/RevisionData.php @@ -98,7 +98,7 @@ * @return int */ public function getParentId() { - return $this->changeParams['parent_id']; + return intval( $this->changeParams['parent_id'] ); } /** diff --git a/repo/Wikibase.hooks.php b/repo/Wikibase.hooks.php index aea60e9..253486e 100644 --- a/repo/Wikibase.hooks.php +++ b/repo/Wikibase.hooks.php @@ -192,12 +192,21 @@ self::notifyEntityStoreWatcherOnUpdate( $revision ); $notifier = WikibaseRepo::getDefaultInstance()->getChangeNotifier(); + $parentId = $revision->getParentId(); - if ( $revision->getParentId() === null ) { + if ( !$parentId ) { $notifier->notifyOnPageCreated( $revision ); } else { - $parent = Revision::newFromId( $revision->getParentId() ); - $notifier->notifyOnPageModified( $revision, $parent ); + $parent = Revision::newFromId( $parentId ); + + if ( !$parent ) { + wfLogWarning( + __METHOD__ . ': Cannot notify on page modification: ' + . 'failed to load parent revision with ID ' . $parentId + ); + } else { + $notifier->notifyOnPageModified( $revision, $parent ); + } } } } -- To view, visit https://gerrit.wikimedia.org/r/386048 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ia4e281c6b499441803b581ba81d3211e1a09789a Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Daniel Kinzler <daniel.kinz...@wikimedia.de> Gerrit-Reviewer: Anomie <bjor...@wikimedia.org> Gerrit-Reviewer: Aude <aude.w...@gmail.com> Gerrit-Reviewer: Ladsgroup <ladsgr...@gmail.com> Gerrit-Reviewer: Thiemo Mättig (WMDE) <thiemo.maet...@wikimedia.de> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits