Error on Dashboard

Hello

After installing the Module “Group” i got an error, when i displays the dashboard

Follow are the error
Warning: key_exists() expects parameter 2 to be array, null given in /var/www/vhosts/xxxx.com/xxx.xxxx.com/Modules/group/group_menu.php on line 7

The Warning are not showing at the Dashboard when you are logged-in.

Version:
PHP Version 7.2.4 (Zend Version 3.2.0)

May someone has an idea to solve my problem

Best Regards
Gregor

Can you try updating and try again to see if the issue is still there and copy the “server information” from the admin page (there is button to copy all the data). We do not know what version emoncms you are using, but I can tell the groups module isn’t the latest as line 7 of group_menu.php is now in a comment block so it’s not clear which actual line is causing the issue.

You should update all the Modules as well as the core as sometimes changes are made to the core to allow certain modules to work.

Hello Paul

I have updated the Groupe and Dashboard as well.

Now i got the follow error when i not logged-in.
Warning: key_exists() expects parameter 2 to be array, null given in /var/www/vhosts/xxx.ch/yyy.xxx.ch/Modules/group/group_menu.php on line 21

Follow the Server information:

Server Information
Emoncms Version 9.8.30 : 2018.05.08
Modules Administration : Dashboard v1.2.0 : Dashboard v1.2.0 : EventProcesses : Feed : Graph v1.2.0 : group : Input : CoreProcess : Schedule : Time : User : Visualisation
Server OS Linux 3.16.0-5-amd64
Host 105.hosttech.eu 105.hosttech.eu (127.0.0.1)
Date 2018-06-06 05:32:06 UTC
Uptime 07:32:06 up 41 days, 19:53, 0 users, load average: 1,03, 1,67, 2,32
HTTP Server Apache HTTP/1.0 CGI/1.1 443
MySQL Version 5.5.5-10.0.32-MariaDB-0+deb8u1
Host localhost (127.0.0.1)
Date 2018-06-06 07:32:06 (UTC 02:00‌​)
Stats Uptime: 3615431 Threads: 3 Questions: 313548948 Slow queries: 3202 Opens: 2198821 Flush tables: 1 Open tables: 9000 Queries per second avg: 86.725
Disk Mount Stats
/ Used: 65,91% Total: 1,11 TB Used: 752,47 GB Free: 331,19 GB
PHP Version 7.2.4 (Zend Version 3.2.0)
Modules

Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /var/www/vhosts/xxx.ch/yyy.xxx.ch/Modules/admin/admin_main_view.php on line 355

bcmath v7.2.4 : bz2 v7.2.4 : calendar v7.2.4 : cgi-fcgi : Core v7.2.4 : ctype v7.2.4 : curl v7.2.4 : date v7.2.4 : dba v7.2.4 : dom v20031129 : enchant v7.2.4 : exif v7.2.4 : fileinfo v1.0.5 : filter v7.2.4 : ftp v7.2.4 : gd v7.2.4 : gettext v7.2.4 : gmp v7.2.4 : hash v1.0 : iconv v7.2.4 : imagick v3.4.3 : imap v7.2.4 : intl v1.1.0 : json v1.6.0 : ldap v7.2.4 : libxml v7.2.4 : mbstring v7.2.4 : mysqli v7.2.4 : mysqlnd : odbc v7.2.4 : openssl v7.2.4 : pcre v7.2.4 : PDO v7.2.4 : pdo_mysql v7.2.4 : PDO_ODBC v7.2.4 : pdo_pgsql v7.2.4 : pdo_sqlite v7.2.4 : pgsql v7.2.4 : Phar v2.0.2 : posix v7.2.4 : pspell v7.2.4 : redis v3.0.0 : Reflection v7.2.4 : session v7.2.4 : SimpleXML v7.2.4 : soap v7.2.4 : sockets v7.2.4 : SPL v7.2.4 : sqlite3 v7.2.4 : standard v7.2.4 : sysvmsg v7.2.4 : sysvsem v7.2.4 : sysvshm v7.2.4 : tidy v7.2.4 : tokenizer v7.2.4 : xml v7.2.4 : xmlreader v7.2.4 : xmlrpc v7.2.4 : xmlwriter v7.2.4 : xsl v7.2.4 : Zend OPcache v7.2.4 : zip v1.15.2 : zlib v7.2.4 :

Client Information
HTTP Browser Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:60.0) Gecko/20100101 Firefox/60.0
Screen Resolution 3840 x 2160
Window Size 3397 x 2007

Hi Gregor.

So line 21 is

if (key_exists('previous_userid', $_SESSION) == true) {

and “key_exists() expects parameter 2 to be array” sounds reasonable enough, the “null given” sounds like something is missing, like the current session details.

After updating I assume you updaed the db from the admin page, did you also do a ctrl-f5 browser refresh?

@cagabi is the lead dev on the groups module, hopefully he or @TrystanLea might be able to shed some light on the matter.

I also notice you have another error reported in your “server information”, it says

Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /var/www/vhosts/xxx.ch/yyy.xxx.ch/Modules/admin/admin_main_view.php on line 355.

and refers to this line

and possibly needs this bit changing from

while ( list($key, $val) = each($system['php_modules']) ) 

to something like

foreach( $system['php_modules'] as $key => $val )

but my PHP isn’t great so I shall wait for comments before doing a PR.

[edit] I decided to open an issue on github for the latter issue.

Hi Paul

The db are up to date, and yes i did ctrl-f5 many times and also deleted the browsers cache.

The error is showing only when i not logged-in

I called the dashboard like the follow
https://yyy.xxx.ch/dashboard/view?id=1&apikey=zzzzzzzzzzzzzzzzzzzzz

Thanks @gkobler for flagging the error and @pb66 for your help.

Because you are not logged in (you are using your apikey) there is no session for you in the server and that made $_SESSION to be null while when you are logged-in the session exists and $_SESSION is an array we use to store info (like permissions, your userid, etc)

I have fixed the problem, please update the group module and confirm here that everything is working ok by marking the post as Solved.

Hello @cagabi

I tryed to download the group module, but i think there are not updated right now! the branch are not actual!

Ups, I did the push but the authentication failed and I didn’t notice :roll_eyes:

Please try again

Thanks @cagabi, the problem are solved

Best Regards
Gregor

1 Like

thanks paul - I’ve used the foreach() as suggested.
pull request submitted :