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 error : traceablePDO #528

Open
h2lsoft opened this issue Feb 28, 2023 · 5 comments
Open

PHP error : traceablePDO #528

h2lsoft opened this issue Feb 28, 2023 · 5 comments

Comments

@h2lsoft
Copy link
Contributor

h2lsoft commented Feb 28, 2023

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
Copy link
Contributor Author

h2lsoft commented Feb 28, 2023

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
Copy link
Contributor Author

h2lsoft commented Feb 28, 2023

PHP 8.1.16

@mumbomedia
Copy link

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'

@angeljqv
Copy link
Contributor

Close by #523

@parallels999
Copy link
Contributor

Already fixed

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

4 participants