Skip to content

Commit

Permalink
Merge pull request #123 from dev-leonunes/main
Browse files Browse the repository at this point in the history
fix(transient): prevent PHP notices by ensuring valid array structure
  • Loading branch information
circlecube authored Feb 6, 2025
2 parents 71f1393 + 3f69df0 commit 5ae2df7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion includes/Helpers/Transient.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,13 @@ public static function get( string $key ) {
\delete_option( $key );
$value = false;
}
}
} else {
/**
* Set $value to false if $data is not a valid array.
* This is to prevent PHP notices when trying to access $data['expires_at'].
*/
$value = false;
}

/**
* Implement the filters as used in {@see get_transient()}.
Expand Down

0 comments on commit 5ae2df7

Please sign in to comment.