What potential issues can arise when setting session cookies in PHP?

One potential issue that can arise when setting session cookies in PHP is that they may not be secure if not properly configured. To ensure the security of session cookies, it is recommended to set the "secure" and "httponly" flags. The "secure" flag ensures that the cookie is only sent over HTTPS connections, while the "httponly" flag prevents the cookie from being accessed by client-side scripts.

// Set session cookie with secure and httponly flags
session_set_cookie_params([
    'secure' => true,
    'httponly' => true
]);
session_start();