From 1340cd3c632d98c9bd9ac6d362b9f10370309305 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Tue, 8 Oct 2024 05:50:27 +0800 Subject: [PATCH] Fix potentially passing null to json_decode --- includes/Hooks.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/Hooks.php b/includes/Hooks.php index 9ff8171ec..bba2af90a 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -67,13 +67,13 @@ public static function onCreateWikiDataFactoryBuilder( string $wiki, IReadableDa // Don't need to manipulate this much if ( ManageWiki::checkSetup( 'settings' ) ) { - $cacheArray['settings'] = json_decode( $setObject->s_settings, true ); + $cacheArray['settings'] = json_decode( $setObject->s_settings ?? '[]', true ); } // Let's create an array of variables so we can easily loop these to enable if ( ManageWiki::checkSetup( 'extensions' ) ) { $manageWikiExtensions = self::getConfig( 'ManageWikiExtensions' ); - foreach ( json_decode( $setObject->s_extensions, true ) as $ext ) { + foreach ( json_decode( $setObject->s_extensions ?? '[]', true ) as $ext ) { $cacheArray['extensions'][] = $manageWikiExtensions[$ext]['var'] ?? $manageWikiExtensions[$ext]['name']; }