From 453c4152af1d94c3207c980293ab1fa602879277 Mon Sep 17 00:00:00 2001 From: "C. Scott Ananian" Date: Wed, 16 Feb 2022 18:31:59 -0500 Subject: [PATCH] ParserOutput::getPageProperty() now returns null when key is missing. The return value of ParserOutput::getPageProperty() has transitioned to returning `null` instead of `false` when the page property is missing. Bug: T301915 Depends-On: Iaa25c390118d2db2b6578cdd558f2defd5351d15 Change-Id: I1126eab0e882b5bdfecea1ef6e3e27dca7b85115 --- includes/Hooks.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/includes/Hooks.php b/includes/Hooks.php index baa6fddc..74f83776 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -106,18 +106,21 @@ class Hooks { } // TODO: Remove when not needed any more, see T267926 - // T301915 - self::logChangeEvent( $revisionRecord, $parserOutput->getPageProperty( 'templatedata' ) ?? false, $user ); + self::logChangeEvent( $revisionRecord, $parserOutput->getPageProperty( 'templatedata' ), $user ); return true; } /** * @param RevisionRecord $revisionRecord - * @param string|false $newPageProperty + * @param ?string $newPageProperty * @param UserIdentity $user */ - private static function logChangeEvent( RevisionRecord $revisionRecord, $newPageProperty, UserIdentity $user ) { + private static function logChangeEvent( + RevisionRecord $revisionRecord, + ?string $newPageProperty, + UserIdentity $user + ) { if ( !ExtensionRegistry::getInstance()->isLoaded( 'EventLogging' ) ) { return; } @@ -129,7 +132,7 @@ class Hooks { $pageId = $page->getId(); // The JSON strings here are guaranteed to be normalized (and possibly compressed) the same // way. No need to normalize them again for this comparison. - if ( $newPageProperty === ( $props[$pageId] ?? false ) ) { + if ( $newPageProperty === ( $props[$pageId] ?? null ) ) { return; }