itsgoingd / clockwork

Clockwork - php dev tools in your browser - server-side component
https://underground.works/clockwork
MIT License
5.69k stars 321 forks source link

ErrorException: Array to string conversion in file /var/www/html/vendor/itsgoingd/clockwork/Clockwork/Storage/SqlStorage.php on line 263 #722

Closed andrew-bannister closed 2 days ago

andrew-bannister commented 3 days ago

Hello, I am getting the title error when trying to use a mysql database as a host. Here are my env settings:

CLOCKWORK_ENABLE=true

CLOCKWORK_STORAGE=sql CLOCKWORK_STORAGE_SQL_DATABASE=mysql CLOCKWORK_STORAGE_SQL_TABLE=clockwork

Line 263 is part of a function, the output of $bindings is probably too large to add in here:


protected function query($query, array $bindings = [], $firstTry = true)
    {
        try {
            if ($stmt = $this->pdo->prepare($query)) {
                if ($stmt->execute($bindings)) return $stmt; //line 263
                throw new \PDOException;
            }
        } catch (\PDOException $e) {
            $stmt = strpos($e->getMessage(), 'Integrity constraint violation') !== false;
        }

        // the query failed to execute, assume it's caused by missing or old schema, try to reinitialize database
        if (! $stmt && $firstTry) {
            $this->initialize();
            return $this->query($query, $bindings, false);
        }
    }
itsgoingd commented 2 days ago

Hey, thanks for the report, this has been fixed in master (847f813) and will be released shortly.

itsgoingd commented 2 days ago

Fixed in Clockwork 5.3.1.