PHP-MySQLi-Database-Class icon indicating copy to clipboard operation
PHP-MySQLi-Database-Class copied to clipboard

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

Open igorek24 opened this issue 3 years ago • 5 comments

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.

igorek24 avatar Mar 13 '21 00:03 igorek24

Hi there, have you updated this class?

omnispecies avatar Mar 13 '21 12:03 omnispecies

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.

igorek24 avatar Mar 13 '21 16:03 igorek24

Thanks it's working

Kavishann avatar Jan 05 '22 00:01 Kavishann

@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

danielcorrea avatar Jan 10 '22 21:01 danielcorrea

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

ejazrasool avatar Dec 24 '23 10:12 ejazrasool