PHP warning: Undefined variable $requirements lockr.install:128

Created on 26 July 2023, over 1 year ago

Problem/Motivation

Looks like this change introduced a little bug where $requirements is undefined in some cases, such as running drush updb.
https://www.drupal.org/project/lockr/issues/3353625 ✨ Implement hook_requirements() Fixed

Steps to reproduce

Run drush updb

Proposed resolution

Set a default value for $requirements

πŸ› Bug report
Status

Fixed

Version

5.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom nicrodgers Monmouthshire, UK

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

Comments & Activities

  • Issue created by @nicrodgers
  • @nicrodgers opened merge request.
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • πŸ‡¬πŸ‡§United Kingdom nicrodgers Monmouthshire, UK
  • πŸ‡¬πŸ‡§United Kingdom nicrodgers Monmouthshire, UK

    Just found out it also breaks drush si if you're installing a new site from an installation profile that uses lockr, eg:

    drush -y -l tribunals si tribunals_profile --db-url=mysql://user:pass@host/tribunals-gen_tribunals_task-gw9311-updates
      You are about to:
      * DROP all tables in your 'tribunals-gen_tribunals_task-gw9311-updates' database.
     
      // Do you want to continue?: yes.                                              
     
      [notice] Starting Drupal installation. This takes a while.
      [notice] Performed install task: install_select_language
      [notice] Performed install task: install_select_profile
      [notice] Performed install task: install_load_profile
      [warning] Undefined variable $requirements lockr.install:128
      [error]  TypeError: array_merge(): Argument #2 must be of type array, null given in array_merge() (line 992 of /var/www/tribunals-gen_task-gw9311-updates_build_307/web/core/includes/install.inc) #0 /var/www/tribunals-gen_task-gw9311-updates_build_307/web/core/includes/install.inc(992): array_merge(Array, NULL)
     #1 /var/www/tribunals-gen_task-gw9311-updates_build_307/web/core/includes/install.core.inc(2067): drupal_check_profile('tribunals_profi...')
     #2 /var/www/tribunals-gen_task-gw9311-updates_build_307/web/core/includes/install.core.inc(1080): install_check_requirements(Array)
     #3 /var/www/tribunals-gen_task-gw9311-updates_build_307/web/core/includes/install.core.inc(698): install_verify_requirements(Array)
     #4 /var/www/tribunals-gen_task-gw9311-updates_build_307/web/core/includes/install.core.inc(569): install_run_task(Array, Array)
     #5 /var/www/tribunals-gen_task-gw9311-updates_build_307/web/core/includes/install.core.inc(119): install_run_tasks(Array, Array)
     #6 /var/www/tribunals-gen_task-gw9311-updates_build_307/vendor/drush/drush/includes/drush.inc(129): install_drupal(Object(Composer\Autoload\ClassLoader), Array, Array)
     #7 /var/www/tribunals-gen_task-gw9311-updates_build_307/vendor/drush/drush/includes/drush.inc(113): drush_call_user_func_array('install_drupal', Array)
     #8 /var/www/tribunals-gen_task-gw9311-updates_build_307/vendor/drush/drush/src/Commands/core/SiteInstallCommands.php(152): drush_op('install_drupal', Object(Composer\Autoload\ClassLoader), Array, Array)
     #9 [internal function]: Drush\Commands\core\SiteInstallCommands->install('tribunals_profi...', Array)
     #10 /var/www/tribunals-gen_task-gw9311-updates_build_307/vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array(Array, Array)
     #11 /var/www/tribunals-gen_task-gw9311-updates_build_307/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
     #12 /var/www/tribunals-gen_task-gw9311-updates_build_307/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
     #13 /var/www/tribunals-gen_task-gw9311-updates_build_307/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(391): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
     #14 /var/www/tribunals-gen_task-gw9311-updates_build_307/vendor/symfony/console/Command/Command.php(326): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
     #15 /var/www/tribunals-gen_task-gw9311-updates_build_307/vendor/symfony/console/Application.php(1081): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
     #16 /var/www/tribunals-gen_task-gw9311-updates_build_307/vendor/symfony/console/Application.php(320): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
     #17 /var/www/tribunals-gen_task-gw9311-updates_build_307/vendor/symfony/console/Application.php(174): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
     #18 /var/www/tribunals-gen_task-gw9311-updates_build_307/vendor/drush/drush/src/Runtime/Runtime.php(124): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
     #19 /var/www/tribunals-gen_task-gw9311-updates_build_307/vendor/drush/drush/src/Runtime/Runtime.php(51): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
     #20 /var/www/tribunals-gen_task-gw9311-updates_build_307/vendor/drush/drush/drush.php(79): Drush\Runtime\Runtime->run(Array)
     #21 /var/www/tribunals-gen_task-gw9311-updates_build_307/vendor/drush/drush/drush(4): require('/var/www/tribun...')
     #22 /var/www/tribunals-gen_task-gw9311-updates_build_307/vendor/bin/drush(119): include('/var/www/tribun...')
     #23 {main}. 
     TypeError: array_merge(): Argument #2 must be of type array, null given in array_merge() (line 992 of /var/www/tribunals-gen_task-gw9311-updates_build_307/web/core/includes/install.inc).
      [warning] Drush command terminated abnormally.
    

    Have confirmed the MR fixes it.

  • Status changed to Fixed over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States Cellar Door

    great catch! Merged into 5.x branch

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

Production build 0.71.5 2024