Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$filename undefined in UpdateDBCommands.php #5853

Open
camslice opened this issue Jan 16, 2024 · 0 comments
Open

$filename undefined in UpdateDBCommands.php #5853

camslice opened this issue Jan 16, 2024 · 0 comments

Comments

@camslice
Copy link

Describe the bug
The $filename variable in UpdateDBCommands.php is undefined:

vendor/drush/drush/src/Commands/core/UpdateDBCommands.php:305

To Reproduce
I discovered this bug here: https://www.drupal.org/project/linktitle/issues/3414898

  1. Install linktitle module latest version 1.0@beta
  2. Update to Drush latest version 12.4.3
  3. Run drush updb

Expected behavior
Drush should populate $filename variable and in turn, be able to locate the file containing the post update warning.

Actual behavior
Console output:

[warning] Undefined variable $filename UpdateDBCommands.php:305
[warning] Post update function linktitle_post_update_warning not found in file .php
[error]  Update failed: linktitle_post_update_warning

Workaround
Diff:

diff --git a/vendor/drush/drush/src/Commands/core/UpdateDBCommands.php b/vendor/drush/drush/src/Commands/core/UpdateDBCommands.php
index 7b95deca1..7a724ca11 100644
--- a/vendor/drush/drush/src/Commands/core/UpdateDBCommands.php
+++ b/vendor/drush/drush/src/Commands/core/UpdateDBCommands.php
@@ -263,6 +263,7 @@ public static function updateDoOnePostUpdate(string $function, array $context):
         }
 
         list($extension, $name) = explode('_post_update_', $function, 2);
+        $filename = $extension . '.post_update';
         $update_registry = \Drupal::service('update.post_update_registry');
         // https://www.drupal.org/project/drupal/issues/3259188 Support theme's
         // having post update functions when it is supported in Drupal core.

System Configuration

Q A
Drush version? 12.14.3
Drupal version? 10.2.1
PHP version 8.1.18
OS? macOS 10.15.7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant