Skip to content

Commit bbafe02

Browse files
committed
v4.4.8.2 beta
1 parent a3eeb8a commit bbafe02

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

redux-core/inc/classes/class-redux-filesystem.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ public function put_contents( string $abs_path, string $contents, string $perms
532532

533533
// phpcs:ignore WordPress.PHP.NoSilencedErrors
534534
// @codingStandardsIgnoreStart
535-
$return = @file_put_contents( $abs_path, $contents );
535+
$return = is_writable( $abs_path ) ? @file_put_contents( $abs_path, $contents ) : false;
536536
// @codingStandardsIgnoreEnd
537537
$this->chmod( $abs_path );
538538

@@ -542,7 +542,8 @@ public function put_contents( string $abs_path, string $contents, string $perms
542542

543543
if ( ! $return && $this->use_filesystem ) {
544544
$abs_path = $this->get_sanitized_path( $abs_path );
545-
$return = $this->wp_filesystem->put_contents( $abs_path, $contents, $perms );
545+
// phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.file_ops_is_writable
546+
$return = is_writable( $abs_path ) && $this->wp_filesystem->put_contents( $abs_path, $contents, $perms );
546547
}
547548

548549
return (bool) $return;

0 commit comments

Comments
 (0)