cobisja / tad-php

PHP Library for ZK Time & Attendance Devices
MIT License
213 stars 159 forks source link

php function each() deprecated as of version 7.2.0 #55

Closed termers closed 5 years ago

termers commented 6 years ago

Function each() deprecation error on php 7.2.0 and above (I'm using 7.2.4 atm)... on TADZKLib.php line 522

ahmedfarghaly1 commented 5 years ago

you can replace these code

   if (is_array($u)) {
        while (list($key) = each($u)) {
            $u = $u[$key];
            break;
        }
    }

    $chksum = $u;
    $reply_id += 1;*/

with

    if (is_array($u)) {
        foreach ($u as $key) {
            $temp = $key;

        }
    }

    $chksum = $temp;
    $reply_id += 1;
termers commented 5 years ago

Yup that is what I did after searching in the internet for some fixes since there was no comment / answer after a week... and it solved my problem... ( forgot to feedback here. )

For others who had the same problem, u can refer to @ahmedfarghaly1 comment for solution.