https://bugzilla.wikimedia.org/show_bug.cgi?id=43810

Dereckson <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #1 from Dereckson <[email protected]> ---
[ Bug analysis ]

(i) $allCampaignNames is an array filled with this code:
    // Get all the initial campaign settings for logging
    $allCampaignNames = $cndb->getAllCampaignNames();
    $allInitialCampaignSettings = array();
    foreach ( $allCampaignNames as $campaignName ) {
            $settings = $cndb->getCampaignSettings( $campaignName, false );
            $allInitialCampaignSettings[ $campaignName ] = $settings;
    }

(ii) CentralNoticeDB::getCampaignSettings is documented to always return an
array. This is a documentation error: it returns false if the SELECT query
doesn't return result:
    (...)
    if ( $row ) {
        (...)
    } else {
        return false;
    }
    (...)

(iii) So in the array_diff_assoc(), first argument
$allInitialCampaignSettings[$campaignName] could be either an array, either
false.

[ Fixes suggestions]

(1) Consider to return an empty array() or to document the mixed return
argument in CentralNoticeDB::getCampaignSettings

(2) If we're in the scenario of a new CentralNotice campaign, I guess an empty
array in 1 would be the idea solution.

If it's another thing (legacy CentralNotice campaigns not in table?), add:
if ( $allInitialCampaignSettings[ $campaignName ] === false ) continue;

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to