Uncaught ArgumentCountError: Too few arguments to function backtrace_error_handler

Created on 24 January 2019, over 6 years ago
Updated 21 November 2023, over 1 year ago

When the site crashes, there's this additional error:

 Fatal error: Uncaught ArgumentCountError: Too few arguments to function backtrace_error_handler(), 4 passed in /Users/joachim/Sites/mysite/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php on line 240 and exactly 5 expected in /Users/joachim/Sites/mysite/web/modules/contrib/devel/devel.module:196 Stack trace: #0 /Users/joachim/Sites/mysite/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php(240): backtrace_error_handler(2, 'session_write_c...', 'Unknown', 0) #1 [internal function]: Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage->Symfony\Component\HttpFoundation\Session\Storage\{closure}(2, 'session_write_c...', 'Unknown', 0, NULL) #2 [internal function]: session_write_close() #3 {main} thrown in /Users/joachim/Sites/mysite/web/modules/contrib/devel/devel.module on line 196
๐Ÿ› Bug report
Status

Fixed

Version

1.0

Component

devel

Created by

๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom joachim

Live updates comments and jobs are added and updated live.

Missing content requested by

๐Ÿ‡ฆ๐Ÿ‡บAustralia dpi
11 months ago
Sign in to follow issues

Comments & Activities

  • Issue created by @joachim
  • I'm getting the same error.

    I made the last argument to the function optional, now it works:

    function backtrace_error_handler($error_level, $message, $filename, $line, $context = [])

    However I don't really know what's happening here and whether this is right or not. $filename, $line and $context are not used at all by this function.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States johne

    I'm running drupal core 8.6.13 where the patch from #2947291 has been committed. The same change is needed, but to devel.module, not bootstrap.inc in drupal core. Here's a patch.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly willzyx

    Committed and pushed to 8.x. Thanks!

  • Automatically closed - issue fixed for 2 weeks with no activity.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States loopy1492

    So apparently there's no devel/issues page on drupal.org? I can't submit a new issue for the d7 version of this error so I guess I'll put it here.
    Error:

    Error message
    ArgumentCountError: Too few arguments to function backtrace_error_handler(), 4 passed and exactly 5 expected in backtrace_error_handler() (line 698 of /var/www/docroot/modules/contrib/devel/devel.module).

    The resolution is exactly the same as for these other issues, just on a different line in the code.

    My patch:

    diff --git a/devel.module b/devel.module
    index ebbbd02d..dfffece7 100755
    --- a/devel.module
    +++ b/devel.module
    @@ -695,7 +695,7 @@ function devel_boot() {
      *   An array that points to the active symbol table at the point the error
      *   occurred.
      */
    -function backtrace_error_handler($error_level, $message, $filename, $line, $context) {
    +function backtrace_error_handler($error_level, $message, $filename = NULL, $line = NULL, $context = NULL) {
       // Hide stack trace and parameters from unqualified users.
       if (!user_access('access devel information')) {
         // Do what core does in bootstrap.inc and errors.inc.
    
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom oily Greater London

    andrew.farquharson โ†’ made their first commit to this issueโ€™s fork.

Production build 0.71.5 2024