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

Assert.php: The path must be a string. Got: boolean #5089

Closed
gitressa opened this issue Mar 9, 2022 · 5 comments · Fixed by #5090
Closed

Assert.php: The path must be a string. Got: boolean #5089

gitressa opened this issue Mar 9, 2022 · 5 comments · Fixed by #5090

Comments

@gitressa
Copy link
Contributor

gitressa commented Mar 9, 2022

Describe the bug

When I run drush core:status with Drush 11.0.6 in Lando I get this error:

In Assert.php line 2060:
  The path must be a string. Got: boolean

If I downgrade to 11.0.5 I get the expected result, and the status report is shown.

Other commands, such as drush watchdog-show and drush core:cron work perfectly fine.

To Reproduce

$ composer create-project -n drupal/recommended-project && cd recommended-project
$ lando init --recipe drupal9 --name drupal9 --source cwd --webroot web
$ lando start
$ composer require -n drush/drush:11.0.6
$ drush site:install --db-url=mysql://drupal9:drupal9@database/drupal9 -y
$ drush core:status
In Assert.php line 2060:
  The path must be a string. Got: boolean

Workaround
Downgrade to Drush 11.0.5 and try again:

$ composer require -n drush/drush:11.0.5 --with-all-dependencies
$ drush core:status
 Drupal version   : 9.3.7                             
 Site URI         : http://default                    
 DB driver        : mysql                             
 DB hostname      : database
 [...]

Note I had to add the --with-all-dependencies parameter to prevent getting stopped by this message:

$ composer require -n drush/drush:11.0.5
For additional security you should declare the allow-plugins config with a list of packages names that are allowed to run code. See https://getcomposer.org/allow-plugins
You have until July 2022 to add the setting. Composer will then switch the default behavior to disallow all plugins.
./composer.json has been updated
Running composer update drush/drush
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires drush/drush 11.0.5 -> satisfiable by drush/drush[11.0.5].
    - drush/drush 11.0.5 requires consolidation/config ^1.2 -> found consolidation/config[1.2.0, 1.2.1] but the package is fixed to 2.1.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

System Configuration

Q A
Drush version 11.0.6
Drupal version 9.3.7
PHP version 8.0.16
OS Ubuntu 20.04.4
Dev system Lando 3.6.2

Additional information
I could only find one file called Assert.php, so I guess it's this one: /vendor/webmozart/assert/src/Assert.php

@weitzman
Copy link
Member

weitzman commented Mar 9, 2022

I tried your steps with ddev instead of lando and I cant reproduce it. Am also using PHP 8.0. I believe that there is an issue, but I dont know where exactly. It might be in Lando. Relevent recent Drush change is at #5049

@gitressa
Copy link
Contributor Author

gitressa commented Mar 9, 2022

Thanks for a fast response. I also tried with Drupal 10 and the Lando drupal10 recipe, with the same result, except downgrading Drush to 11.0.5 didn't seem to help.

Manually reverting the changes from issue #5049 did fix it, so the changes in that PR is likely the cause of the error.

Here is a slightly detailed error description:

$ lando drush st -vvv
lando 19:44:30 DEBUG ==> No update available. 
lando 19:44:30 VERBOSE ==> starting bootstrap at level engine... 
lando 19:44:30 VERBOSE ==> config bootstrap beginning... 
lando 19:44:30 DEBUG ==> emitting event pre-bootstrap-config 
lando 19:44:30 DEBUG ==> plugin lando-core loaded from /snapshot/cli/plugins/lando-core/index.js 
[...]
[debug] Add a commandfile class: Drush\Drupal\Commands\sql\SanitizeUserTableCommands [0.14 sec, 21.21 MB]

In Assert.php line 2060:
                                               
  [Webmozart\Assert\InvalidArgumentException]  
  The path must be a string. Got: boolean      
                                               

Exception trace:
  at /app/vendor/webmozart/assert/src/Assert.php:2060
 Webmozart\Assert\Assert::reportInvalidArgument() at /app/vendor/webmozart/assert/src/Assert.php:51
 Webmozart\Assert\Assert::string() at /app/vendor/webmozart/path-util/src/Path.php:87
 Webmozart\PathUtil\Path::canonicalize() at n/a:n/a
 array_map() at /app/vendor/drush/drush/src/Commands/core/StatusCommands.php:137
 Drush\Commands\core\StatusCommands->getPropertyList() at /app/vendor/drush/drush/src/Commands/core/StatusCommands.php:81
 Drush\Commands\core\StatusCommands->status() at n/a:n/a
 call_user_func_array() at /app/vendor/consolidation/annotated-command/src/CommandProcessor.php:257
 Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback() at /app/vendor/consolidation/annotated-command/src/CommandProcessor.php:212
 Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter() at /app/vendor/consolidation/annotated-command/src/CommandProcessor.php:176
 Consolidation\AnnotatedCommand\CommandProcessor->process() at /app/vendor/consolidation/annotated-command/src/AnnotatedCommand.php:350
 Consolidation\AnnotatedCommand\AnnotatedCommand->execute() at /app/vendor/symfony/console/Command/Command.php:298
 Symfony\Component\Console\Command\Command->run() at /app/vendor/symfony/console/Application.php:1033
 Symfony\Component\Console\Application->doRunCommand() at /app/vendor/symfony/console/Application.php:299
 Symfony\Component\Console\Application->doRun() at /app/vendor/symfony/console/Application.php:171
 Symfony\Component\Console\Application->run() at /app/vendor/drush/drush/src/Runtime/Runtime.php:121
 Drush\Runtime\Runtime->doRun() at /app/vendor/drush/drush/src/Runtime/Runtime.php:51
 Drush\Runtime\Runtime->run() at /app/vendor/drush/drush/drush.php:72
 require() at /app/vendor/drush/drush/drush:4
 include() at /app/vendor/bin/drush:117

lando 19:44:31 DEBUG ==> process pid4 finished with exit code 1 

@weitzman
Copy link
Member

weitzman commented Mar 9, 2022

11.0.7 is released. lemme know if it still fails.

@gitressa
Copy link
Contributor Author

gitressa commented Mar 9, 2022

Wow that was fast, thanks! I can confirm that the command works again:

$ drush core:status
 Drupal version   : 10.0.0-dev                        
 Site URI         : http://default                    
 DB driver        : mysql                             
 DB hostname      : database 
[...]

@loic860
Copy link

loic860 commented Jun 6, 2024

Hello,
I am facing the same issue.
How can I fix it?

The trace
[sysuser_f@serveur2 drupal]$ /opt/plesk/php/8.2/bin/php-cgi vendor/drush/drush/drush.php status TypeError: Symfony\Component\Filesystem\Path::canonicalize(): Argument #1 ($path) must be of type string, bool given,

[sysuser_f@serveur2 drupal]$ /opt/plesk/php/8.2/bin/php-cgi vendor/drush/drush/drush.php -- version Drush version : 12.5.2.0 X-Powered-By: PHP/8.2.19 Content-type: text/html; charset=UTF-8

Durpal version is 10.2.6
regards

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

Successfully merging a pull request may close this issue.

3 participants