Skip to content

Show literal "true"/"false" for boolean config values instead of "1"/empty string#213

Merged
swissspidy merged 5 commits intomainfrom
copilot/show-boolean-true-false
Mar 12, 2026
Merged

Show literal "true"/"false" for boolean config values instead of "1"/empty string#213
swissspidy merged 5 commits intomainfrom
copilot/show-boolean-true-false

Conversation

Copy link
Contributor

Copilot AI commented Mar 12, 2026

PHP boolean constants in wp-config.php were displayed as 1 (true) or empty string (false) in wp config get and wp config list, making it impossible to distinguish false from an empty string value.

Changes

  • list_(): Convert boolean values to "true"/"false" strings before format_items(), skipping json and yaml formats which represent booleans natively
  • get(): Same boolean-to-string conversion for non-json/non-yaml formats
  • print_dotenv(): Explicit boolean handling outputs unquoted true/false (e.g. WP_DEBUG=true) before the single-quote escaping path

Before / After

# Before
$ wp config get WP_DEBUG_DISPLAY
           ← empty string for false

$ wp config list
WP_DEBUG        1       constant
WP_DEBUG_DISPLAY        constant

# After
$ wp config get WP_DEBUG_DISPLAY
false

$ wp config list
WP_DEBUG        true    constant
WP_DEBUG_DISPLAY  false   constant

JSON and YAML output formats are unchanged — they continue to emit native boolean types (true/false without quotes).

Test coverage

  • Updated existing dotenv format scenario: WP_ALLOW_MULTISITE=1true, SUBDOMAIN_INSTALL=''false
  • New config-get-field scenarios covering boolean true/false output and JSON format preservation
  • New config-list scenarios covering table, JSON (native booleans preserved), and dotenv formats

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • api.wordpress.org
    • Triggering command: /usr/bin/curl curl -s REDACTED (dns block)
  • downloads.wordpress.org
    • Triggering command: /usr/bin/curl curl -sSfL REDACTED (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Show literal "true"/"false" when reading boolean values instead of an empty string</issue_title>
<issue_description>## Feature Request

Describe your use case and the problem you are facing

Running wp config list or wp config get, boolean values are shown as 1 / empty string.

$ wp config list
name    value   type
...
WP_DEBUG        1       constant
WP_DEBUG_LOG    1       constant
WP_DEBUG_DISPLAY                constant
$ wp config get WP_DEBUG_DISPLAY

Describe the solution you'd like

Instead of echoing directly the boolean value, resulting in 1 / nothing, boolean values should be considered strictly and shown as true / false, i.e.

$ wp config list
name    value   type
...
WP_DEBUG        true       constant
WP_DEBUG_LOG    true       constant
WP_DEBUG_DISPLAY   false             constant
$ wp config get WP_DEBUG_DISPLAY
false

In this way we could understand better if we set really a false value or an empty string instead.</issue_description>

<agent_instructions>Use #182 as inspiration. Add comprehensive Behat test coverage.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…nfig list

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot AI changed the title [WIP] Show literal 'true'/'false' for boolean values Show literal "true"/"false" for boolean config values instead of "1"/empty string Mar 12, 2026
@github-actions github-actions bot added command:config-get Related to 'config get' command command:config-list Related to 'config list' command scope:testing Related to testing labels Mar 12, 2026
@codecov
Copy link

codecov bot commented Mar 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@swissspidy swissspidy marked this pull request as ready for review March 12, 2026 16:43
@swissspidy swissspidy requested a review from a team as a code owner March 12, 2026 16:43
Copilot AI review requested due to automatic review settings March 12, 2026 16:43
@swissspidy swissspidy added this to the 2.5.0 milestone Mar 12, 2026

This comment was marked as resolved.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@swissspidy swissspidy merged commit 97a28da into main Mar 12, 2026
60 checks passed
@swissspidy swissspidy deleted the copilot/show-boolean-true-false branch March 12, 2026 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

command:config-get Related to 'config get' command command:config-list Related to 'config list' command scope:testing Related to testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show literal "true"/"false" when reading boolean values instead of an empty string

3 participants