From 0c660fda14af1111075d9f49b9448d5665b37143 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Pe=CC=81rez?= <jaime.perez@uninett.no> Date: Mon, 4 Jul 2016 13:54:25 +0200 Subject: [PATCH] Add error codes to the SimpleSAML\Error\CannotSetCookie exception. This way we can discern why we couldn't set a cookie, and act accordingly. --- lib/SimpleSAML/Error/CannotSetCookie.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/SimpleSAML/Error/CannotSetCookie.php b/lib/SimpleSAML/Error/CannotSetCookie.php index 65b6ee8e2..31a25b0c5 100644 --- a/lib/SimpleSAML/Error/CannotSetCookie.php +++ b/lib/SimpleSAML/Error/CannotSetCookie.php @@ -12,4 +12,25 @@ namespace SimpleSAML\Error; class CannotSetCookie extends \SimpleSAML_Error_Exception { + /** + * The exception was thrown for unknown reasons. + * + * @var int + */ + const UNKNOWN = 0; + + /** + * The exception was due to the HTTP headers being already sent, and therefore we cannot send additional headers to + * set the cookie. + * + * @var int + */ + const HEADERS_SENT = 1; + + /** + * The exception was due to trying to set a secure cookie over an insecure channel. + * + * @var int + */ + const SECURE_COOKIE = 2; } -- GitLab