Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Make sure third setCookie parameter is integer #480

Merged
merged 1 commit into from Dec 4, 2016
Merged

Make sure third setCookie parameter is integer #480

merged 1 commit into from Dec 4, 2016

Conversation

milkyway-git
Copy link
Contributor

setCookie will work even if NOW or $expiration is a string

setCookie will work even if NOW or $expiration is a string
@zegenie zegenie merged commit 25360cd into thebuggenie:master Dec 4, 2016
@@ -535,7 +535,7 @@ public function getFooterDecoration()
*/
public function setCookie($key, $value, $expiration = 864000)
{
$expiration = ($expiration !== null) ? NOW + $expiration : null;
$expiration = ($expiration !== null) ? intval(NOW + $expiration) : null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've seen this crop up before, and I'd like to find out where this code is being called with $expiration being a string.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think its a question of where its called (in my case runDoElevatedLogin in main\controllers\main.php), its about the environment. In my case it was:
PHP 7.0.13 and XAMPP.
"gettype (NOW)" returns string (even if its defined as "define('NOW', (integer) $starttime[1]);" in \core\framework\Context.php ), as a consequence of this "gettype ($expiration)" returns float.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch

@milkyway-git milkyway-git deleted the patch-2 branch December 5, 2016 09:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants