https://github.com/matomo-org/matomo/commit/5b48e4f57dd62c1a3188e1f6b8cdbbaf47635104 - Mouve

Site d'origine

Permalink
Browse files

Prevent memory error when using PHP8 and a session error happens (#16943

)

Noticed it exceeded 512MB, then 2GB, ...

It was running in an endless loop because 

> PHP Fatal error:  Uncaught ArgumentCountError: Too few arguments to function Zend_Session_Exception::handleSessionStartError(), 4 passed and exactly 5 expected i

See https://www.php.net/manual/en/function.set-error-handler.php

> Since PHP 8: errcontext was removed, and will no longer be passed to user callbacks.

There might be also other places where we maybe use error handler
  • Loading branch information
tsteur committed Dec 13, 2020
1 parent 6c8c118 commit 5b48e4f57dd62c1a3188e1f6b8cdbbaf47635104
Showing with 2 additions and 2 deletions.
  1. +2 −2 libs/Zend/Session/Exception.php
@@ -54,7 +54,7 @@ class Zend_Session_Exception extends Zend_Exception
* @param string $errstr
* @return void
*/
static public function handleSessionStartError($errno, $errstr, $errfile, $errline, $errcontext)
static public function handleSessionStartError($errno, $errstr, $errfile, $errline, $errcontext = '')
{
$message = $errfile . '(Line:' . $errline . '): Error #' . $errno . ' ' . $errstr;
if (E_ERROR === $errno || E_CORE_ERROR === $errno || E_COMPILE_ERROR === $errno) {
@@ -72,7 +72,7 @@ static public function handleSessionStartError($errno, $errstr, $errfile, $errli
* @param string $errstr
* @return void
*/
static public function handleSilentWriteClose($errno, $errstr, $errfile, $errline, $errcontext)
static public function handleSilentWriteClose($errno, $errstr, $errfile, $errline, $errcontext = '')
{
self::$sessionStartError .= PHP_EOL . $errfile . '(Line:' . $errline . '): Error #' . $errno . ' ' . $errstr;
}

0 comments on commit 5b48e4f

Please sign in to comment.

Raccourcis

Commandes

Fermer