Last modified: 2013-04-22 16:14:19 UTC
PHP Warning: array_diff_assoc(): Argument #1 is not an array in /usr/local/apache/common-local/php-1.21wmf7/extensions/CentralNotice/special/SpecialCentralNotice.php on line 156 This looks to be caused by some problem in the logging code. I'm tracking this with FR-Tech mingle card #730 [https://mingle.corp.wikimedia.org/projects/fundraiser_2012/cards/730].
[ 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;
This patch should resolve the issue. https://gerrit.wikimedia.org/r/43355
@Dereckson -- thanks for the analysis. That sped this up considerably.
You're welcome.
Merged by Pgehres on the 11th of January.