Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-81829

Sometimes Whoops breaks and makes it harder to debug the real issue

XMLWordPrintable

      There are some edge cases where something is broken and Whoops kicks in but then all the debugging information it gives is about itself breaking and not the root cause. If you turn it off then you get some more meaningful stacktraces.

      There are multiple failures, this issue fixes one of them but not the ones below which I'll turn into another tracker once I can reproduce it properly.

       

       

      eg I have gotten this error:

      Fatal error: Uncaught Whoops\Exception\ErrorException: Undefined array key 1 in /var/www/master/vendor/filp/whoops/src/Whoops/Exception/FrameCollection.php:113 Stack trace: #0 /var/www/master/lib/setuplib.php(504): Whoops\Run->handleError(2, 'Undefined array...', '/var/www/master...', 113) #1 /var/www/master/vendor/filp/whoops/src/Whoops/Exception/FrameCollection.php(113): default_error_handler(2, 'Undefined array...', '/var/www/master...', 113) #2 /var/www/master/lib/setuplib.php(392): Whoops\Exception\FrameCollection->offsetGet(1) #3 /var/www/master/vendor/filp/whoops/src/Whoops/Handler/CallbackHandler.php(50): {closure}(Object(moodle_exception), Object(Whoops\Exception\Inspector), Object(Whoops\Run)) #4 /var/www/master/vendor/filp/whoops/src/Whoops/Run.php(398): Whoops\Handler\CallbackHandler->handle(Object(moodle_exception)) #5 /var/www/master/lib/setuplib.php(443): Whoops\Run->handleException(Object(moodle_exception)) #6 [internal function]: default_exception_handler(Object(moodle_exception)) #7 {main} thrown in /var/www/master/vendor/filp/whoops/src/Whoops/Exception/FrameCollection.php on line 113

       

      After turning off whoops I get this much more useful error:

       
      Exception calling 'tool_redirects_after_config' * line ? of unknownfile: call to default_error_handler()

      • line 89 of /admin/tool/redirects/classes/regex_validator.php: call to preg_match()
      • line 62 of /admin/tool/redirects/classes/regex_validator.php: call to tool_redirects\regex_validator->validate_syntax()
      • line 82 of /admin/tool/redirects/classes/helper.php: call to tool_redirects\regex_validator->__construct()
      • line 52 of /admin/tool/redirects/classes/helper.php: call to tool_redirects\helper::build_rules_from_config()
      • line 102 of /admin/tool/redirects/classes/helper.php: call to tool_redirects\helper::get_all_rules()
      • line 41 of /admin/tool/redirects/lib.php: call to tool_redirects\helper::redirect_from_rules()
      • line 1152 of /lib/setup.php: call to tool_redirects_after_config()
      • line 246 of /config.php: call to require_once()
      • line 94 of /admin/index.php: call to require()
         

      Fatal error: Uncaught coding_exception: Coding error detected, it must be fixed by a programmer: PHP catchable fatal error (Cannot modify header information - headers already sent by (output started at /var/www/master/lib/weblib.php:3340)) in /var/www/master/lib/setuplib.php:508 Stack trace: #0 [internal function]: default_error_handler(2, 'Cannot modify h...', '/var/www/master...', 439) #1 /var/www/master/lib/setuplib.php(439): header_remove('Content-Length') #2 [internal function]: default_exception_handler(Object(moodle_exception)) #3 {main} thrown in /var/www/master/lib/setuplib.php on line 508

       

      The real issue here isn't important (was a php8 deprecation in a plugin). I also get a similar issue with whoops when you checkout a branch a slightly old branch which emits some debugging combined with an exception. Without whoops I get useful errors:

      Hook callback definition contains invalid 'callback' class name in 'tool_mobile'. Callback class 'tool_mobile\hook_callbacks' not found.

      and then later down the page is the exception:
      ERROR!!! The code you are using is OLDER than the version that made these databases!

      More information about this error
      Debug info:
      Error code: downgradedcore×Dismiss this notification
      Stack trace: * line 536 of /admin/index.php: moodle_exception thrown
       

      But if I turn whoops on then I get the meaningless error:

      Fatal error: Uncaught Whoops\Exception\ErrorException: Undefined array key 1 in /var/www/master/vendor/filp/whoops/src/Whoops/Exception/FrameCollection.php:113 Stack trace: #0 /var/www/master/lib/setuplib.php(504): Whoops\Run->handleError(2, 'Undefined array...', '/var/www/master...', 113) #1 /var/www/master/vendor/filp/whoops/src/Whoops/Exception/FrameCollection.php(113): default_error_handler(2, 'Undefined array...', '/var/www/master...', 113) #2 /var/www/master/lib/setuplib.php(392): Whoops\Exception\FrameCollection->offsetGet(1) #3 /var/www/master/vendor/filp/whoops/src/Whoops/Handler/CallbackHandler.php(50): {closure}(Object(moodle_exception), Object(Whoops\Exception\Inspector), Object(Whoops\Run)) #4 /var/www/master/vendor/filp/whoops/src/Whoops/Run.php(398): Whoops\Handler\CallbackHandler->handle(Object(moodle_exception)) #5 /var/www/master/lib/setuplib.php(443): Whoops\Run->handleException(Object(moodle_exception)) #6 [internal function]: default_exception_handler(Object(moodle_exception)) #7 {main} thrown in /var/www/master/vendor/filp/whoops/src/Whoops/Exception/FrameCollection.php on line 113

       

       

       

       

        1. image-2024-06-20-11-19-12-985.png
          image-2024-06-20-11-19-12-985.png
          39 kB
        2. image-2024-06-20-11-20-08-608.png
          image-2024-06-20-11-20-08-608.png
          42 kB
        3. MDL-81829_nowarning.png
          MDL-81829_nowarning.png
          20 kB
        4. MDL-81829.png
          MDL-81829.png
          196 kB
        5. MDL-81829-1.diff
          0.5 kB
        6. MDL-81829-2.diff
          0.4 kB
        7. Screenshot 2025-02-05 154848.png
          Screenshot 2025-02-05 154848.png
          565 kB

            brendanheywood Brendan Heywood
            brendanheywood Brendan Heywood
            Paul Holden Paul Holden
            Jun Pataleta Jun Pataleta
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 3 hours, 46 minutes
                3h 46m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.