cosmocode / contagged

ConTagged is a web-based address book for small companies written in PHP.
http://www.cosmocode.de/en/opensource/contagged
63 stars 19 forks source link

Error after login when "Stay logged in on this computer" is checked #16

Open vicentini opened 6 years ago

vicentini commented 6 years ago

The following error is shown on a blank page after login, when "Stay logged in on this computer" is checked on the login page.

Warning: trim() expects parameter 1 to be string, array given in /var/www/html/inc/functions.php on line 156
Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/inc/functions.php:156) in /var/www/html/inc/functions.php on line 145
Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/inc/functions.php:156) in /var/www/html/login.php on line 27

Even though the error shows up, the login seems to work. After a refresh of the page the user is logged in and the contacts are presented as expected.

My installation is as follows

vicentini commented 6 years ago

I've found the reason for this issue. As it's only a small fix I won't create a pull request for it.

In file ./inc/functions.php line 156 return md5(trim(file($file))); the file method returns an array of strings which trim can't work on.

Instead the method file_get_contents should be used which returns a string with the whole file content. return md5(trim(file_get_contents($file)));