Closed pwtyler closed 1 month ago
Describe the current, buggy behavior
wp config has fails in a read-only environment.
wp config has
Error: Could not process the 'wp-config.php' transformation. Reason: wp-config.php is not writable.
Describe how other contributors can replicate this bug Steps to reproduce:
#!/bin/bash curl -O https://raw.githubusercontent.com/pantheon-systems/WordPress/default/wp-config.php wp config has table_prefix echo $? # Output: 0 chmod 444 wp-config.php wp config has table_prefix echo $? # Output: 1
Describe what you would expect as the correct outcome
wp config has works when the file is not readable, as it is only reading the content of the file. Let us know what environment you are running this on
Originally encountered on Pantheon's read-only live environment, but reproduced locally
OS: Darwin 23.5.0 Darwin Kernel Version 23.5.0: Wed May 1 20:12:58 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6000 arm64 Shell: /bin/zsh PHP binary: /opt/homebrew/Cellar/php/8.3.2/bin/php PHP version: 8.3.2 php.ini used: /opt/homebrew/etc/php/8.3/php.ini MySQL binary: /opt/homebrew/bin/mysql MySQL version: mysql from 11.2.2-MariaDB, client 15.2 for osx10.19 (arm64) using EditLine wrapper SQL modes: STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION WP-CLI root dir: phar://wp-cli.phar/vendor/wp-cli/wp-cli WP-CLI vendor dir: phar://wp-cli.phar/vendor WP_CLI phar path: /Users/philtyler/Desktop/scratch WP-CLI packages dir: WP-CLI cache dir: /Users/philtyler/.wp-cli/cache WP-CLI global config: WP-CLI project config: WP-CLI version: 2.10.0
Yah, it seems WPConfigTransformer checks in the constructor whether config file is writable or not.
WPConfigTransformer
https://github.com/wp-cli/wp-config-transformer/blob/main/src/WPConfigTransformer.php#L48-L50
Bug Report
Describe the current, buggy behavior
wp config has
fails in a read-only environment.Describe how other contributors can replicate this bug Steps to reproduce:
Describe what you would expect as the correct outcome
wp config has
works when the file is not readable, as it is only reading the content of the file. Let us know what environment you are running this onOriginally encountered on Pantheon's read-only live environment, but reproduced locally