# Error on Dashboard

**URL:** <https://community.openenergymonitor.org/t/error-on-dashboard/7584>\
**Category:** Emoncms\
**Tags:** emoncms\
**Created:** [5 June 2018 11:21 UTC](https://community.openenergymonitor.org/t/error-on-dashboard/7584 "2018-06-05T11:21:05Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![gkobler](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/g/e99b99/32.png) [@gkobler](https://community.openenergymonitor.org/u/gkobler)\
**Post date:** [5 June 2018 11:21 UTC](https://community.openenergymonitor.org/t/error-on-dashboard/7584/1 "2018-06-05T11:21:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pb66](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/pb66/32/27_2.png) [@pb66](https://community.openenergymonitor.org/u/pb66)\
**Post date:** [5 June 2018 20:18 UTC](https://community.openenergymonitor.org/t/error-on-dashboard/7584/2 "2018-06-05T20:18:02Z")

</div>

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.

> <https://github.com/emoncms/group/blob/master/group_menu.php#L7>

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.

---

<div class="post-metadata">

**Author:** ![gkobler](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/g/e99b99/32.png) [@gkobler](https://community.openenergymonitor.org/u/gkobler)\
**Post date:** [6 June 2018 05:32 UTC](https://community.openenergymonitor.org/t/error-on-dashboard/7584/3 "2018-06-06T05:32:53Z")

</div>

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 |
> ```

---

<div class="post-metadata">

**Author:** ![pb66](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/pb66/32/27_2.png) [@pb66](https://community.openenergymonitor.org/u/pb66)\
**Post date:** [6 June 2018 16:44 UTC](https://community.openenergymonitor.org/t/error-on-dashboard/7584/4 "2018-06-06T16:44:44Z")

</div>

Hi Gregor.

So line 21 is

```auto
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

> <https://github.com/emoncms/emoncms/blob/9.8.30/Modules/admin/admin_main_view.php#L355>

and possibly needs this bit changing from

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

```

to something like

```auto
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.

> <https://github.com/emoncms/emoncms/issues/860>
>
> See https://community.openenergymonitor.org/t/error-on-dashboard/7584/4?u=pb66 f…or more info.
> 
> possibly needs \[this bit at line 355\](https://github.com/emoncms/emoncms/blob/9.8.30/Modules/admin/admin\_main\_view.php#L355) changing from
> \`\`\`
> while ( list($key, $val) = each($system\['php\_modules'\]) ) 
> \`\`\`
> to something like
> \`\`\`
> foreach( $system\['php\_modules'\] as $key =\> $val )

---

<div class="post-metadata">

**Author:** ![gkobler](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/g/e99b99/32.png) [@gkobler](https://community.openenergymonitor.org/u/gkobler)\
**Post date:** [7 June 2018 05:33 UTC](https://community.openenergymonitor.org/t/error-on-dashboard/7584/5 "2018-06-07T05:33:05Z")

</div>

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](https://yyy.xxx.ch/dashboard/view?id=1&apikey=zzzzzzzzzzzzzzzzzzzzz)

---

<div class="post-metadata">

**Author:** ![cagabi](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/cagabi/32/5438_2.png) [@cagabi](https://community.openenergymonitor.org/u/cagabi)\
**Post date:** [7 June 2018 12:09 UTC](https://community.openenergymonitor.org/t/error-on-dashboard/7584/6 "2018-06-07T12:09:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![gkobler](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/g/e99b99/32.png) [@gkobler](https://community.openenergymonitor.org/u/gkobler)\
**Post date:** [7 June 2018 12:25 UTC](https://community.openenergymonitor.org/t/error-on-dashboard/7584/7 "2018-06-07T12:25:30Z")

</div>

Hello @cagabi

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

---

<div class="post-metadata">

**Author:** ![cagabi](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/cagabi/32/5438_2.png) [@cagabi](https://community.openenergymonitor.org/u/cagabi)\
**Post date:** [7 June 2018 12:47 UTC](https://community.openenergymonitor.org/t/error-on-dashboard/7584/8 "2018-06-07T12:47:02Z")

</div>

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

Please try again

---

<div class="post-metadata">

**Author:** ![gkobler](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/g/e99b99/32.png) [@gkobler](https://community.openenergymonitor.org/u/gkobler)\
**Post date:** [8 June 2018 04:58 UTC](https://community.openenergymonitor.org/t/error-on-dashboard/7584/9 "2018-06-08T04:58:47Z")

</div>

Thanks @cagabi, the problem are solved

Best Regards  
Gregor

---

<div class="post-metadata">

**Author:** ![emrys](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/emrys/32/7050_2.png) [@emrys](https://community.openenergymonitor.org/u/emrys)\
**Post date:** [8 June 2018 10:13 UTC](https://community.openenergymonitor.org/t/error-on-dashboard/7584/10 "2018-06-08T10:13:20Z")

</div>

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

> <https://github.com/emoncms/emoncms/pull/866>
