Open damienmckenna opened 1 week ago
I added print_r($options) to SqlBase::dump() and this is what it shows:
Array
(
[result-file] => auto
[create-db] =>
[data-only] =>
[ordered-dump] =>
[gzip] =>
[extra] =>
[extra-dump] =>
[format] => null
[database] => default
[db-url] =>
[target] => default
[show-passwords] =>
[skip-tables-key] =>
[structure-tables-key] => common
[tables-key] =>
[skip-tables-list] =>
[structure-tables-list] =>
[tables-list] =>
[fields] =>
[field] =>
[druplicon] =>
[notify] =>
[xh-link] =>
[help] =>
[quiet] =>
[verbose] =>
[version] =>
[ansi] =>
[no-interaction] =>
[yes] =>
[no] =>
[root] => /var/www/html/web
[uri] => https://mysite.ddev.site
[simulate] =>
[define] => Array
(
)
[xdebug] =>
)
As you can see, the "structure-tables-key" value is defined correctly but "gzip" is not.
If I add verbose: true
to the drush.yml that value doesn't change in the $options output.
If I comment out the structure-tables-key
line the value does change.
These just confirm that boolean values are not loaded properly.
This has been broken for years. In ancient versions of Symfony, it worked. Then, Symfony became more strict, and it stopped working. I forget the details of what changed, but the basic problem is that boolean CLI options do not take a default value, so the config code can't follow its usual pattern of setting the default value of the Symfony Console input item. Years and years ago, I submitted a feature enhancement to Symfony console, adding negatable binary cli options that had the ability to set their default value; however, I didn't have time to do the work to get it merged. Then, years ago, someone else picked it up and got it merged, but they decided that the ability to set the default value of a binary cli option was unnecessary, so consolidation/config remains broken.
I don't know if there's another way to fix this that doesn't involve changing Symfony.
Describe the bug Boolean options defined in drush/drush.yml aren't used when running sql-dump.
To Reproduce drush.yml:
Run
drush sql-dump --result-file=auto
.Expected behavior A gzip file is saved.
Actual behavior A text sql file is caved.
Workaround Pass --gzip at runtime.
System Configuration