diff --git a/redux-core/inc/classes/class-redux-filesystem.php b/redux-core/inc/classes/class-redux-filesystem.php index 4d21b1b87..2cd869c16 100644 --- a/redux-core/inc/classes/class-redux-filesystem.php +++ b/redux-core/inc/classes/class-redux-filesystem.php @@ -532,7 +532,7 @@ public function put_contents( string $abs_path, string $contents, string $perms // phpcs:ignore WordPress.PHP.NoSilencedErrors // @codingStandardsIgnoreStart - $return = @file_put_contents( $abs_path, $contents ); + $return = is_writable( $abs_path ) ? @file_put_contents( $abs_path, $contents ) : false; // @codingStandardsIgnoreEnd $this->chmod( $abs_path ); @@ -542,7 +542,8 @@ public function put_contents( string $abs_path, string $contents, string $perms if ( ! $return && $this->use_filesystem ) { $abs_path = $this->get_sanitized_path( $abs_path ); - $return = $this->wp_filesystem->put_contents( $abs_path, $contents, $perms ); + // phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.file_ops_is_writable + $return = is_writable( $abs_path ) && $this->wp_filesystem->put_contents( $abs_path, $contents, $perms ); } return (bool) $return;