foz1234 Posted November 28, 2016 Share Posted November 28, 2016 As title suggests i am getting a repetitive error in my log:- [28-Nov-2016 13:30:32 Europe/London] PHP Warning: array_keys() expects parameter 1 to be array, boolean given in /home/domain/public_html/admin/sources/dashboard.index.inc.php on line 311 this appears to be the line its referring to in the files (dashboard.index.inc.php) $extension_updates = $GLOBALS['db']->select('CubeCart_extension_info', false, array('file_id' => array_keys($extension_updates))); any ideas? thanks Quote Link to comment Share on other sites More sharing options...
keat Posted November 28, 2016 Share Posted November 28, 2016 I'm guessing that it's looking for a database table called extension_info. I'm on V6 and don't see this table, what version are you on ? Quote Link to comment Share on other sites More sharing options...
bsmither Posted November 28, 2016 Share Posted November 28, 2016 This is a known error with CC611. A new feature that requests the version of installed extensions to determine if an update is available. If you are running CC611 and do not have a table named CubeCart_extension_info, then the database has not been upgraded to match the code version of CC611. Quote Link to comment Share on other sites More sharing options...
foz1234 Posted November 28, 2016 Author Share Posted November 28, 2016 thanks for your replies, is there a fix for this or must i wait? thanks Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted November 28, 2016 Share Posted November 28, 2016 From GitHub https://github.com/cubecart/v6/pull/1107 Quote Quote It won't support extensions from 3rd party stores or marketplaces. Only extensions obtained from the CubeCart marketplace via install token will have new version notifications. SemperFiWebServices extensions have a way to be informed of updates being available. Hopefully other developers will soon have something similar for plugins they do not have in the Extension Marketplace. Quote Link to comment Share on other sites More sharing options...
bsmither Posted November 28, 2016 Share Posted November 28, 2016 "Is there a fix for [these errors getting logged] or must i wait?" In the file /admin/sources/dashboard.index.inc.php, near line 134: Find: $version_check = true; Change to: $version_check = array('-1' => null); // true; The variable $version_check is supposed to be an array. Plus, the key of the array cannot appear to be empty, nor can it be an extension code that might actually exist. The array keys (extension codes) are used to get more data about extensions from the CubeCart_extension_info database table (added as of CC610). Empty array keys are discarded by CubeCart's database code. So, an array key of -1 is used as the extension code, which is guaranteed to not interfere with actual extension codes. Note: the value of $version_check is set in the Session and will persist during the session. So, now that the value of $version_check has changed, you will need to log out of admin (destroying the Session), and log back in to get the new value set into Session. All of the new code for the new Extension Updates feature can be better written, but this small change is the most effective, least intrusive fix. Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted November 28, 2016 Share Posted November 28, 2016 I need clarification @bsmither Is your code change above a temporary solution to stop the nagging error message, OR is it a better code that will still provide the update available notice without the nagging error message? Quote Link to comment Share on other sites More sharing options...
bsmither Posted November 28, 2016 Share Posted November 28, 2016 The above is temporary until the developers figure out a better code solution (if they are interested in doing so). Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted January 4, 2017 Share Posted January 4, 2017 Well, no good news on this one yet As of 6.1.3 I'm still having to use your code change to keep from filling up the error log with these warnings. I spoke too soon. I'm still getting this message (with your code edit from above near line 134). Quote [04-Jan-2017 13:39:54 America/Chicago] PHP Warning: array_keys() expects parameter 1 to be array, boolean given in /home/butter01/public_html/plushcatalog/XXX/sources/dashboard.index.inc.php on line 321 Line 321 is $extension_updates = $GLOBALS['db']->select('CubeCart_extension_info', false, array('file_id' => array_keys($extension_updates))); Quote Link to comment Share on other sites More sharing options...
bsandall Posted January 4, 2017 Share Posted January 4, 2017 Perhaps something like: if($GLOBALS['session']->has('version_check')) { $extension_updates = $GLOBALS['session']->get('version_check'); $file_ids = (is_array($extension_updates) && !empty($extension_updates) ? array_keys($extension_updates) : array(-1)); $extension_updates = $GLOBALS['db']->select('CubeCart_extension_info', false, array('file_id' => $file_ids)); Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted January 4, 2017 Share Posted January 4, 2017 Crashing when I tried to use it. Did I put it in the right place? {* if($GLOBALS['session']->has('version_check')) { $extension_updates = $GLOBALS['session']->get('version_check'); $extension_updates = $GLOBALS['db']->select('CubeCart_extension_info', false, array('file_id' => array_keys($extension_updates))); if($extension_updates) { $GLOBALS['main']->addTabControl($lang['dashboard']['title_extension_updates'], 'extension_updates', null, null, count($extension_updates)); $GLOBALS['smarty']->assign('EXTENSION_UPDATES', $extension_updates); } } *} ## BRIANSANDAL IGNORE PLUGIN UPDATE ERROR MESSAGE *} if($GLOBALS['session']->has('version_check')) { $extension_updates = $GLOBALS['session']->get('version_check'); $file_ids = (is_array($extension_updates) && !empty($extension_updates) ? array_keys($extension_updates) : array(-1)); $extension_updates = $GLOBALS['db']->select('CubeCart_extension_info', false, array('file_id' => $file_ids)); } ## END BRIANSANDAL IGNORE PLUGIN UPDATE ERROR MESSAGE *} Quote Link to comment Share on other sites More sharing options...
bsandall Posted January 4, 2017 Share Posted January 4, 2017 The lines I posted are meant to replace the first 3 lines in the section you commented out, so it should be: if($GLOBALS['session']->has('version_check')) { $extension_updates = $GLOBALS['session']->get('version_check'); $file_ids = (is_array($extension_updates) && !empty($extension_updates) ? array_keys($extension_updates) : array(-1)); $extension_updates = $GLOBALS['db']->select('CubeCart_extension_info', false, array('file_id' => $file_ids)); if($extension_updates) { $GLOBALS['main']->addTabControl($lang['dashboard']['title_extension_updates'], 'extension_updates', null, null, count($extension_updates)); $GLOBALS['smarty']->assign('EXTENSION_UPDATES', $extension_updates); } } If that still crashes, try changing the `array(-1)` to `array(0)`. If that also crashes, post the error message. Also, '{*' is not correct syntax for PHP comments - you should use '/* .... */' instead. That could be why your code is crashing. Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted January 5, 2017 Share Posted January 5, 2017 That seems to be working - THANKS! I always have to try {* /* // ## and <!-- ways to comment, as I have never understood when to use each one. Quote Link to comment Share on other sites More sharing options...
bsandall Posted January 5, 2017 Share Posted January 5, 2017 15 hours ago, Dirty Butter said: That seems to be working - THANKS! I always have to try {* /* // ## and <!-- ways to comment, as I have never understood when to use each one. It depends on which language you are writing in - each one has its own syntax. PHP and most if not all C-based languages (among others) use `//` and `/* ... */` for comments; `#` is used in many languages as well, most notably SQL; `{* ... *}` is I believe a Smarty-only syntax; `<!-- ... -->` is HTML. Anyway, glad that got rid of the error message for you - I'll make a PR in GitHub for it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.