php-debugbar icon indicating copy to clipboard operation
php-debugbar copied to clipboard

PHP error : traceablePDO

Open h2lsoft opened this issue 2 years ago • 5 comments

DebugBar\DataCollector\PDO\TraceablePDO::getAccumulatedStatementsDuration(): Return value must be of type float, null returned

File : maximebf/debugbar/src/DebugBar/DataCollector/PDO/TraceablePDO.php:251

line 251 : return array_reduce($this->executedStatements, function ($v, $s) { return $v + $s->getDuration(); });

h2lsoft avatar Feb 28 '23 13:02 h2lsoft

PATCH File : maximebf/debugbar/src/DebugBar/DataCollector/PDO/TraceablePDO.php:251

` /** * Returns the accumulated execution time of statements * * @return float */ public function getAccumulatedStatementsDuration() : float { return (float)array_reduce($this->executedStatements, function ($v, $s) { return $v + $s->getDuration(); }); }

/**
 * Returns the peak memory usage while performing statements
 *
 * @return int
 */
public function getMemoryUsage() : int
{
    return (int)array_reduce($this->executedStatements, function ($v, $s) { return $v + $s->getMemoryUsage(); });
}

/**
 * Returns the peak memory usage while performing statements
 *
 * @return int
 */
public function getPeakMemoryUsage() : int
{
    return (int)array_reduce($this->executedStatements, function ($v, $s) { $m = $s->getEndMemory(); return $m > $v ? $m : $v; });
}`

h2lsoft avatar Feb 28 '23 13:02 h2lsoft

PHP 8.1.16

h2lsoft avatar Feb 28 '23 13:02 h2lsoft

Also get "Use of "parent" in callables is deprecated" due to the use in bindColumn and bindParam on PHP 7.4.

Fix: Replace 'parent' with 'PDOStatement'

mumbomedia avatar Aug 01 '23 12:08 mumbomedia

Close by https://github.com/maximebf/php-debugbar/pull/523

angeljqv avatar Aug 23 '23 19:08 angeljqv

Already fixed

parallels999 avatar Jan 17 '24 13:01 parallels999