Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

NillaBlog PHP error with Vanilla 2.0.18.14?

This discussion is related to the NillaBlog addon.
khalwatkhalwat New
edited November 2014 in Vanilla 2.0 - 2.8

I downloaded and enabled the latest NillaBlog, after clicking on "Enable" it generated a PHP error. Below is the gory details.

So obviously I can see the problem, the variable $Wheres is set to the string "all" and array_key_exists() expects that it's going to be an array. Is this just an error in the code? Did this plugin ever work on 2.0.18.x?

Environment:

Additional information for support personnel:
Application: Vanilla
Application Version: 2.0.18.14
PHP Version: 5.3.3
Operating System: Linux
Server Software: Apache/2.2.15 (CentOS)
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/600.1.25 (KHTML, like Gecko) Version/8.0 Safari/600.1.25
Request Uri: /forums/dashboard/settings/plugins
Controller: PHP
Method: array_key_exists

Error:

array_key_exists() expects parameter 2 to be array, string given
The error occurred on or near: /var/www/clp/forums/plugins/NillaBlog/class.nillablog.plugin.php
165:     * @param $Sender
166:     */
167:    public function DiscussionModel_BeforeGet_Handler($Sender) {
168:        $Wheres = $Sender->EventArguments["Wheres"];
169:        if (!array_key_exists("d.CategoryID", $Wheres) || !in_array($Wheres["d.CategoryID"], C("Plugins.NillaBlog.CategoryIDs")))
170:            return;
171: 
172:        $Sender->EventArguments["SortField"] = "d.DateInserted";
173:        $Sender->EventArguments["SortDirection"] = "desc";

Backtrace:

/var/www/clp/forums/plugins/NillaBlog/class.nillablog.plugin.phpPHP::Gdn_ErrorHandler();
[/var/www/clp/forums/plugins/NillaBlog/class.nillablog.plugin.php:169] PHP::array_key_exists();
[/var/www/clp/forums/library/core/class.pluginmanager.php:648] NillaBlog->DiscussionModel_BeforeGet_Handler();
[/var/www/clp/forums/library/core/class.pluginmanager.php:590] Gdn_PluginManager->CallEventHandler();
[/var/www/clp/forums/library/core/class.pluggable.php:127] Gdn_PluginManager->CallEventHandlers();
[/var/www/clp/forums/applications/vanilla/models/class.discussionmodel.php:164] Gdn_Pluggable->FireEvent();
[/var/www/clp/forums/plugins/LatestPostList/modules/class.latestpostlistmodule.php:27] DiscussionModel->Get();
[/var/www/clp/forums/plugins/LatestPostList/class.latestpostlist.plugin.php:45] LatestPostListModule->SetData();
[/var/www/clp/forums/plugins/LatestPostList/class.latestpostlist.plugin.php:100] LatestPostList->LoadLPLModule();
[/var/www/clp/forums/library/core/class.pluginmanager.php:648] LatestPostList->Base_Render_Before();
[/var/www/clp/forums/library/core/class.pluginmanager.php:594] Gdn_PluginManager->CallEventHandler();
[/var/www/clp/forums/library/core/class.pluggable.php:179] Gdn_PluginManager->CallEventHandlers();
[/var/www/clp/forums/applications/dashboard/controllers/class.settingscontroller.php:666] Gdn_Pluggable->__call();
[/var/www/clp/forums/applications/dashboard/controllers/class.settingscontroller.php:666] SettingsController->Render();
[/var/www/clp/forums/applications/dashboard/controllers/class.settingscontroller.php:666] SettingsController->Plugins();
[/var/www/clp/forums/library/core/class.dispatcher.php:322] PHP::call_user_func_array();
[/var/www/clp/forums/index.php:53] Gdn_Dispatcher->Dispatch();

Variables in scope:

Variables in local scope:
[Sender] array (
  'Watching' => false,
  'Data' => NULL,
  'Database' => 'SECURITY',
  'DateInserted' => 'DateInserted',
  'DateUpdated' => 'DateUpdated',
  'InsertUserID' => 'InsertUserID',
  'Name' => 'Discussion',
  'PrimaryKey' => 'id',
  'Schema' => NULL,
  'SQL' => 
  array (
    'CaptureModifications' => false,
    'ClassName' => 'Gdn_MySQLDriver',
    'Database' => 'SECURITY',
    '_Order' => false,
  ),
  'UpdateUserID' => 'UpdateUserID',
  'Validation' => 
  array (
  ),
  'EventArguments' => 
  array (
    'SortField' => 'd.DateLastComment',
    'SortDirection' => 'desc',
    'Wheres' => 'all',
  ),
  'Returns' => 
  array (
    'discussionmodel_beforeget_handler' => 
    array (
    ),
  ),
  'HandlerType' => 'NORMAL',
)
[Wheres] 'all'

Comments

Sign In or Register to comment.