[Legacy] Fix #543: Make StackTraceErrorHandler $errcontext parameter optional

The $errcontext parameter was deprecated in PHP 7.2+ and removed in PHP 8.0+, causing ArgumentCountError when PHP's internal error handler calls the function with only 4 arguments instead of the expected 5.

Made $errcontext parameter optional with null default value to maintain backward compatibility while fixing the stack trace functionality.

  - Fix public/legacy/include/utils.php:3933 StackTraceErrorHandler function signature
  - Resolves 500 errors when stack_trace_errors is enabled
  - Maintains backward compatibility for legacy code calling with 5 arguments
This commit is contained in:
Moises E. Puyosa 2025-07-17 08:13:12 -05:00 committed by Jack Anderson
parent 1ac4f6d699
commit ca50436c6d

View file

@ -3930,7 +3930,7 @@ function display_stack_trace($textOnly = false)
return $out;
}
function StackTraceErrorHandler($errno, $errstr, $errfile, $errline, $errcontext)
function StackTraceErrorHandler($errno, $errstr, $errfile, $errline, $errcontext = null)
{
$error_msg = " $errstr occurred in <b>$errfile</b> on line $errline [" . date('Y-m-d H:i:s') . ']';