ThingEngineer / PHP-MySQLi-Database-Class

Wrapper for a PHP MySQL class, which utilizes MySQLi and prepared statements.
Other
3.3k stars 1.34k forks source link

implode(): Argument #2 ($array) must be of type ?array, string given #960

Open igorek24 opened 3 years ago

igorek24 commented 3 years ago

Got an error while trying to upgrade my app to php8 when doing insert. Type: TypeError Message: implode(): Argument #2 ($array) must be of type ?array, string given File: /home/shadow/Projects/opensystools/vendor/joshcam/mysqli-database-class/MysqliDb.php Line: 18 when I change $this->_query .= ' (' . implode($dataColumns, ',') . ') '; to $this->_query .= ' (' . implode(',', $dataColumns) . ') ';'; according to https://www.php.net/manual/en/function.implode.php, separator and array are reversed now since php 7.4.0

8.0.0 Passing the separator after the array is no longer supported.
7.4.0 Passing the separator after the array (i.e. using the legacy signature) has been deprecated.
omnispecies commented 3 years ago

Hi there, have you updated this class?

igorek24 commented 3 years ago

Yes, and it works just fine. I have modified for now but I'm using composer and it's a paint to change on every project. For now, I just cloned it in to my own repo and pull it from there.

Kavishann commented 2 years ago

Thanks it's working

danielcorrea commented 2 years ago

@igorek24 Good solution and help! I could only feel this problem today when I updated my development environment to PHP8 Hope @ThingEngineer will update the class in the repository

ejazrasool commented 10 months ago

Composer and Github has the same version of this class (2.9.3) but the code in composer looks older.