Skip to content

Commit

Permalink
Fix potentially passing null to json_decode
Browse files Browse the repository at this point in the history
  • Loading branch information
Universal-Omega authored Oct 7, 2024
1 parent 34ad8c5 commit 1340cd3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions includes/Hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
}
Expand Down

0 comments on commit 1340cd3

Please sign in to comment.