PHP-MySQLi-Database-Class
PHP-MySQLi-Database-Class copied to clipboard
implode(): Argument #2 ($array) must be of type ?array, string given
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. |
Hi there, have you updated this class?
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.
Thanks it's working
@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
Composer and Github has the same version of this class (2.9.3) but the code in composer looks older.