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

Undefined constant Drush\Drupal\Commands\sql\SanitizeCommands::SANITIZE in ReflectionAttribute->newInstance() #5865

Closed
vcmnetwork opened this issue Feb 12, 2024 · 2 comments

Comments

@vcmnetwork
Copy link

vcmnetwork commented Feb 12, 2024

Describe the bug
I get an error output when I run any drush command in Drupal:

To Reproduce
I executed "drush ws" or "drush cr".

Expected behavior
I expected the commands to output as it normally does.

Actual behavior
It returns the following output:

[error] Error: Undefined constant Drush\Drupal\Commands\sql\SanitizeCommands::SANITIZE in ReflectionAttribute->newInstance() (line 30 of /var/www/html/sunraz-dev/vendor/consolidation/annotated-command/src/Attributes/Hook.php) #0 /var/www/html/sunraz-dev/vendor/consolidation/annotated-command/src/Attributes/Hook.php(30): ReflectionAttribute->newInstance()
#1 [internal function]: Consolidation\AnnotatedCommand\Attributes\Hook::handle()
#2 /var/www/html/sunraz-dev/vendor/consolidation/annotated-command/src/Parser/Internal/AttributesDocBlockParser.php(33): call_user_func()
#3 /var/www/html/sunraz-dev/vendor/consolidation/annotated-command/src/Parser/Internal/CommandDocBlockParserFactory.php(14): Consolidation\AnnotatedCommand\Parser\Internal\AttributesDocBlockParser->parse()
#4 /var/www/html/sunraz-dev/vendor/consolidation/annotated-command/src/Parser/CommandInfo.php(879): Consolidation\AnnotatedCommand\Parser\Internal\CommandDocBlockParserFactory::parse()
#5 /var/www/html/sunraz-dev/vendor/consolidation/annotated-command/src/Parser/CommandInfo.php(341): Consolidation\AnnotatedCommand\Parser\CommandInfo->parseDocBlock()
#6 /var/www/html/sunraz-dev/vendor/drush/drush/src/Command/DrushCommandInfoAlterer.php(14): Consolidation\AnnotatedCommand\Parser\CommandInfo->hasAnnotation()
#7 /var/www/html/sunraz-dev/vendor/consolidation/annotated-command/src/AnnotatedCommandFactory.php(541): Drush\Command\DrushCommandInfoAlterer->alterCommandInfo()
#8 /var/www/html/sunraz-dev/vendor/consolidation/annotated-command/src/AnnotatedCommandFactory.php(325): Consolidation\AnnotatedCommand\AnnotatedCommandFactory->alterCommandInfo()
#9 /var/www/html/sunraz-dev/vendor/consolidation/annotated-command/src/AnnotatedCommandFactory.php(209): Consolidation\AnnotatedCommand\AnnotatedCommandFactory->createCommandInfoListFromClass()
#10 /var/www/html/sunraz-dev/vendor/consolidation/annotated-command/src/AnnotatedCommandFactory.php(201): Consolidation\AnnotatedCommand\AnnotatedCommandFactory->getCommandInfoListFromClass()
#11 /var/www/html/sunraz-dev/vendor/consolidation/robo/src/Runner.php(353): Consolidation\AnnotatedCommand\AnnotatedCommandFactory->createCommandsFromClass()
#12 /var/www/html/sunraz-dev/vendor/drush/drush/src/Boot/DrupalBoot8.php(310): Robo\Runner->registerCommandClass()
#13 /var/www/html/sunraz-dev/vendor/drush/drush/src/Boot/DrupalBoot8.php(253): Drush\Boot\DrupalBoot8->addDrupalModuleDrushCommands()
#14 /var/www/html/sunraz-dev/vendor/drush/drush/src/Boot/BootstrapManager.php(291): Drush\Boot\DrupalBoot8->bootstrapDrupalFull()
#15 /var/www/html/sunraz-dev/vendor/drush/drush/src/Boot/BootstrapManager.php(477): Drush\Boot\BootstrapManager->doBootstrap()
#16 /var/www/html/sunraz-dev/vendor/drush/drush/src/Boot/BootstrapManager.php(412): Drush\Boot\BootstrapManager->bootstrapMax()
#17 /var/www/html/sunraz-dev/vendor/drush/drush/src/Boot/BootstrapManager.php(384): Drush\Boot\BootstrapManager->bootstrapToPhaseIndex()
#18 /var/www/html/sunraz-dev/vendor/drush/drush/src/Boot/BootstrapHook.php(32): Drush\Boot\BootstrapManager->bootstrapToPhase()
#19 /var/www/html/sunraz-dev/vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php(44): Drush\Boot\BootstrapHook->initialize()
#20 /var/www/html/sunraz-dev/vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php(36): Consolidation\AnnotatedCommand\Hooks\Dispatchers\InitializeHookDispatcher->doInitializeHook()
#21 /var/www/html/sunraz-dev/vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php(29): Consolidation\AnnotatedCommand\Hooks\Dispatchers\InitializeHookDispatcher->callInitializeHook()
#22 /var/www/html/sunraz-dev/vendor/consolidation/annotated-command/src/CommandProcessor.php(145): Consolidation\AnnotatedCommand\Hooks\Dispatchers\InitializeHookDispatcher->initialize()
#23 /var/www/html/sunraz-dev/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(376): Consolidation\AnnotatedCommand\CommandProcessor->initializeHook()
#24 /var/www/html/sunraz-dev/vendor/symfony/console/Command/Command.php(221): Consolidation\AnnotatedCommand\AnnotatedCommand->initialize()
#25 /var/www/html/sunraz-dev/vendor/symfony/console/Application.php(1039): Symfony\Component\Console\Command\Command->run()
#26 /var/www/html/sunraz-dev/vendor/symfony/console/Application.php(275): Symfony\Component\Console\Application->doRunCommand()
#27 /var/www/html/sunraz-dev/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun()
#28 /var/www/html/sunraz-dev/vendor/drush/drush/src/Runtime/Runtime.php(124): Symfony\Component\Console\Application->run()
#29 /var/www/html/sunraz-dev/vendor/drush/drush/src/Runtime/Runtime.php(51): Drush\Runtime\Runtime->doRun()
#30 /var/www/html/sunraz-dev/vendor/drush/drush/drush.php(79): Drush\Runtime\Runtime->run()
#31 /var/www/html/sunraz-dev/vendor/drush/drush/drush(4): require('...')
#32 /var/www/html/sunraz-dev/vendor/bin/drush(119): include('...')
#33 {main}.

Workaround
There is no workaround

System Configuration

Q A
Drush version? 11.6.0
Drupal version? 9.5.11
PHP version 8.1.26
OS? Red Hat Linux

Additional information
Add any other context about the problem here.

As I have been awaiting a response to this issue, i have attempted additional task to either fix or understand the scope of the issue. It should be noted that I have installed and am using the 'drupal/domain:2.0.0-beta1' module. The significance of this is that when I run execute drush commands under the primary domain, the commands execute as expected. However, when I run a drush command under a different sub-domain; meaning that I switch to another folder such as '/web/sites/sub-domain', I get the error output previously posted. Secondarily, when I execute 'drush cr' under the sub-domain folder, the output returns as expected. However, if I simply execute 'drush', it returns the error output. I am lost as to how to fix this issue.

@weitzman
Copy link
Member

I suggest passing --uri and not relying on a subdir for Drush to learn its context.

As Drush 11 is unsupported and Drupal 9 is unsupported, thats about all the help I can provide here. You might have better luck in the domain issue queue.

@weitzman weitzman closed this as not planned Won't fix, can't repro, duplicate, stale Feb 14, 2024
@vcmnetwork
Copy link
Author

I managed to resolve the issue through a process of trial and error. Unfortunately, I will be unable to define how the fix occurred, due to not documenting the steps I took. However, my process involved updating dependencies associated with upgrading to Drush 12, however reverting back to Drush 11 because drush 12 requires an upgrade to Drupal 10. Upgrading to Drupal 10 requires upgrading a large number of Drupal and vendor dependencies that are not easily accommodated with Composer terminal commands, due to the need to make a lot of line item adjustments in the composer.json file, which will further impact my timelines. The bottom line for me is that the issue is resolved.

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

2 participants