dsoares / roundcube-lastlogin

Roundcube plugin to save and show user login information and login history.
GNU General Public License v3.0
16 stars 12 forks source link

php 5.X not specified (fix available) #2

Closed mckaygerhard closed 8 years ago

mckaygerhard commented 8 years ago

in function load_log the return value are seted in a while using a php 5.4 only line code:$rows[] = $res; so must be changed to complaint php 5.3 as: array_push($rows, $res)

here: https://github.com/dsoares/Roundcube-Plugin-Lastlogin/blob/master/lastlogin.php#L193

and with that are compatible with php 5.3.3

dsoares commented 8 years ago

$rows[] = $res; is compatible with PHP 5.3. Also, from the PHP manual:

Note: If you use array_push() to add one element to the array it's better to use $array[] = because in that way there is no overhead of calling a function.

mckaygerhard commented 8 years ago

are u sure? i read the php manual, and of course said that its compatible, but the table in configuration->last login are not fill!

i write log of the retun value and does not retun sometigh

the query are good, i sustitue the ip of select and only removed the if conditional , the select returns 8 rows but the array are not fill with those rows (column names date, geo, dns, and from are in right place)

dsoares commented 8 years ago

Yes i'm sure :) What is the SQL driver you are using? Also, please try the code with changes i've made today.

mckaygerhard commented 8 years ago

i comment in the commit, thanks, this solved the string show to user of location in human readable format.. now correctly said "From Caracas, Venezuela, etc etc"

i used the sqlite, postgres and orafe(oracle/postgres) drivers, in production i used only postgres.

thanks, but i used the array_merge due are only available since php 5.3.10, so this issue still are opened..

so i research more around the arrray changes in php 5.3/5.4 api and report feeedback here!

dsoares commented 8 years ago

I'm going to close this issue because i'm pretty sure that the line $rows[] = $res; is compatible with PHP 5.3 (and previous versions and 5.4 and 5.5). There's no need of array_merge() ou array_push().