Throws error when user with uid 1 does not exist

Created on 1 February 2023, almost 2 years ago

Problem/Motivation

When user with uid 1 does not exist, then `ensureSuperAdminUserIsSecure` method throws an error:

 Fatal error: Uncaught Error: Call to a member function isActive() on null in /var/www/html/web/modules/contrib/domino/src/SuperAdminUser.php:104                    
  Stack trace:                                                                                                                                                        
  #0 /var/www/html/web/modules/contrib/domino/domino.module(33): Drupal\domino\SuperAdminUser->ensureSuperAdminUserIsSecure()                                         
  #1 [internal function]: domino_cache_flush()                                                                                                                        
  #2 /var/www/html/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(426): call_user_func_array()                                                                  
  #3 /var/www/html/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(405): Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}()                  
  #4 /var/www/html/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(433): Drupal\Core\Extension\ModuleHandler->invokeAllWith()                                    
  #5 /var/www/html/web/core/includes/common.inc(545): Drupal\Core\Extension\ModuleHandler->invokeAll()                                                                
  #6 /var/www/html/web/core/includes/utility.inc(41): drupal_flush_all_caches()                                                                                       
  #7 /var/www/html/vendor/drush/drush/src/Commands/core/CacheCommands.php(227): drupal_rebuild()                                                                      
  #8 [internal function]: Drush\Commands\core\CacheCommands->rebuild()                                                                                                
  #9 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array()                                                       
  #10 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback()       
  #11 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter()      
  #12 /var/www/html/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(350): Consolidation\AnnotatedCommand\CommandProcessor->process()                  
  #13 /var/www/html/vendor/symfony/console/Command/Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand->execute()                                       
  #14 /var/www/html/vendor/symfony/console/Application.php(1039): Symfony\Component\Console\Command\Command->run()                                                    
  #15 /var/www/html/vendor/symfony/console/Application.php(275): Symfony\Component\Console\Application->doRunCommand()                                                
  #16 /var/www/html/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun()                                                       
  #17 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(124): Symfony\Component\Console\Application->run()                                                     
  #18 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(51): Drush\Runtime\Runtime->doRun()                                                                    
  #19 /var/www/html/vendor/drush/drush/drush.php(77): Drush\Runtime\Runtime->run()                                                                                    
  #20 /var/www/html/vendor/drush/drush/drush(4): require('...')                                                                                                       
  #21 /var/www/html/vendor/bin/drush(120): include('...')                                                                                                             
  #22 {main}         

Steps to reproduce

- Install latest Domino
- Truncate users table
- Flush all caches - the error will appear

Proposed resolution

Add a condition to check if user with uid 1 exists.

🐛 Bug report
Status

Fixed

Version

3.0

Component

Code

Created by

🇧🇾Belarus spleshka UAE

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024