Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 7.4 PHP Deprecated: implode(): Passing glue string after array is deprecated. Swap the parameters in vendor/tommyknocker/pdo-database-class/PDODb.php on line 435 #10

Closed
parto254 opened this issue Jan 17, 2020 · 6 comments

Comments

@parto254
Copy link

PHP 7.4 deprecated notice when inserting values using an array as the data source

The code:

$this->model->db->insert(
    'roles',
    [
        'role'=>'editor',
        'description'=>'Blog editor. Has access to blogs and blog posts.'
    ]
);

The error

PHP Deprecated: implode(): Passing glue string after array is deprecated. Swap the parameters in vendor/tommyknocker/pdo-database-class/PDODb.php on line 435

@bas-surlinio
Copy link

Replace this line with:
if (isset($dataColumns[0])) $this->query .= ' ('.implode(', ',$dataColumns).') ';

@Phenomite
Copy link

@bas-surlinio

Replace this line with:
if (isset($dataColumns[0])) $this->query .= ' ('.implode(', ',$dataColumns).') ';

As in this?

L435:

if (isset($dataColumns[0])) $this->query .= ' (`\'.implode(\'`, `\'$dataColumns).\'`) ';

@bas-surlinio
Copy link

Correct

@borakayalar
Copy link

        //if (isset($dataColumns[0])) $this->query .= ' (`'.implode($dataColumns, '`, `').'`) ';
        if (isset($dataColumns[0])) $this->query .= ' (`' . implode('`, `', $dataColumns) . '`) ';

@gvlasov
Copy link

gvlasov commented Dec 19, 2021

Will there be a release with this change?

@tommyknocker
Copy link
Owner

Yeah, sure. Releazed v1.1.1 today

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants