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

[4.x]: Console commands has different defaults when non-interactive #11650

Closed
ishitatsuyuki opened this issue Jul 21, 2022 · 2 comments
Closed

Comments

@ishitatsuyuki
Copy link

What happened?

Description

All confirm() calls in console commands default to true if 1. the controller doesn't manually check for interactivity and 2. interactive = false (pipe stdin or CLI option).

Steps to reproduce

  1. Run php craft users/create --email [email protected] --username User --groups Group --interactive 0
  2. The result is an activated, admin user, which is different from the prompt's default (not activated since no password specified, not admin).

This is due to a bad behavior in Yii's console helper: when non-interactive, confirm will always return true instead of the specified default value. I don't think this is desirable for Craft, so it might makes sense to create a helper in Craft's controller class that does not have this behavior.

Craft CMS version

4.1.4.1

PHP version

No response

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

No response

@brandonkelly
Copy link
Member

Agree that’s not ideal. It’s a slight behavior change so I’ve just started ignoring certain confirm()s for non-interactive shells, for Craft 4.2 (imminent).

@brandonkelly
Copy link
Member

Craft 4.2.0 is out now with those CLI changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants