What potential pitfalls should be considered when using DateTime::COOKIE with setcookie in PHP?

When using DateTime::COOKIE with setcookie in PHP, it's important to remember that DateTime::COOKIE format includes both the date and time, which may not be supported by all browsers. To ensure compatibility, it's recommended to use a different date format such as 'D, d-M-Y H:i:s T'. This will prevent potential issues with browsers that do not support the full DateTime::COOKIE format.

$expiry = new DateTime();
$expiry->modify('+1 day');
$expiry_formatted = $expiry->format('D, d-M-Y H:i:s T');
setcookie('cookie_name', 'cookie_value', $expiry->getTimestamp(), '/', '', false, true);