From a2c3ac38c6262d4625de3a764544c05c3d0fef31 Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Mon, 2 Dec 2024 13:46:39 +1000 Subject: [PATCH] Fix PHPCS checks on unwritable filesystems. In #744 a call to setConfigData() was added which has the `$temporary` parameter set to the default, which is `true`. This causes PHPCS to attempt to write to `wp-content/plugins/plugin-check-trunk/vendor/squizlabs/php_codesniffer/CodeSniffer.conf` which is unwritable on immutable filesystems, causing the entire plugin check to abort. --- includes/Checker/Checks/Abstract_PHP_CodeSniffer_Check.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/Checker/Checks/Abstract_PHP_CodeSniffer_Check.php b/includes/Checker/Checks/Abstract_PHP_CodeSniffer_Check.php index 23b1bcdc..8c98e01a 100644 --- a/includes/Checker/Checks/Abstract_PHP_CodeSniffer_Check.php +++ b/includes/Checker/Checks/Abstract_PHP_CodeSniffer_Check.php @@ -100,7 +100,7 @@ final public function run( Check_Result $result ) { // Override installed_paths to load custom sniffs. if ( isset( $args['installed_paths'] ) && is_array( $args['installed_paths'] ) ) { - Config::setConfigData( 'installed_paths', implode( ',', $args['installed_paths'] ) ); + Config::setConfigData( 'installed_paths', implode( ',', $args['installed_paths'] ), true ); } // Create the default arguments for PHPCS. @@ -121,7 +121,7 @@ final public function run( Check_Result $result ) { } // Reset installed_paths. - Config::setConfigData( 'installed_paths', $installed_paths ); + Config::setConfigData( 'installed_paths', $installed_paths, true ); // Restore original arguments. $_SERVER['argv'] = $orig_cmd_args;