diff options
| author | xXx-caillou-xXx | 2017-12-20 16:08:18 +0100 |
|---|---|---|
| committer | jvoisin | 2017-12-20 16:08:18 +0100 |
| commit | a1675cd79b0df2478026573b0fac52464ef3c1b7 (patch) | |
| tree | c40520065b0a7c4c9b9e8fb22250d5b8cbc30c39 /src/tests | |
| parent | f7dfc937ebc7317fd3ff168e062d32119913d7ae (diff) | |
Make `setcookie` return true
We forgot to set a return value to the setcookie function, thus always returning false. Since very few frameworks/developers are checking the return value, it went unnoticed until we played with Magento, who effectively checks the return value.
Diffstat (limited to 'src/tests')
| -rw-r--r-- | src/tests/samesite_cookies.phpt | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/tests/samesite_cookies.phpt b/src/tests/samesite_cookies.phpt index 12f3d72..fe74172 100644 --- a/src/tests/samesite_cookies.phpt +++ b/src/tests/samesite_cookies.phpt | |||
| @@ -14,10 +14,18 @@ HTTPS=1 | |||
| 14 | EOF; | 14 | EOF; |
| 15 | --FILE-- | 15 | --FILE-- |
| 16 | <?php | 16 | <?php |
| 17 | setcookie("super_cookie", "super_value"); | 17 | if (!setcookie("super_cookie", "super_value")) { |
| 18 | setcookie("awful_cookie", "awful_value"); | 18 | echo "setcookie failed.\n"; |
| 19 | setcookie("not_encrypted", "test_value", 1, "1", "1", false, true); | 19 | } |
| 20 | setcookie("nice_cookie", "nice_value", 1, "1", "1", true, true); | 20 | if (!setcookie("awful_cookie", "awful_value")) { |
| 21 | echo "setcookie failed.\n"; | ||
| 22 | } | ||
| 23 | if (!setcookie("not_encrypted", "test_value", 1, "1", "1", false, true)) { | ||
| 24 | echo "setcookie failed.\n"; | ||
| 25 | } | ||
| 26 | if (!setcookie("nice_cookie", "nice_value", 1, "1", "1", true, true)) { | ||
| 27 | echo "setcookie failed.\n"; | ||
| 28 | } | ||
| 21 | 29 | ||
| 22 | $expected = array( | 30 | $expected = array( |
| 23 | 'Set-Cookie: super_cookie=super_value; path=; samesite=Lax', | 31 | 'Set-Cookie: super_cookie=super_value; path=; samesite=Lax', |
