Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the opt out work when a PHP 32 bit is used #18019

Closed
samuel-lobby opened this issue Sep 16, 2021 · 15 comments · Fixed by #18179
Closed

Make the opt out work when a PHP 32 bit is used #18019

samuel-lobby opened this issue Sep 16, 2021 · 15 comments · Fixed by #18179
Assignees
Labels
Bug For errors / faults / flaws / inconsistencies etc. Help wanted Beginner friendly issues or issues where we'd highly appreciate community's help and involvement.
Milestone

Comments

@samuel-lobby
Copy link

Hello all,

The iframe I added for the opt out works fine, at least as far as tracking is concerned. If I click on the checkbox it is unchecked and the text of the iframe changes after a reload of the page. If I reload the page again, the "old" text is displayed plus the checkbox is checked again.
However, the cookie for the opt out is set correctly and also works correctly.
But I would like the checkbox and the text to remain after an opt out. Do I have to set anything extra for this or is this a bug?

Thank's a lot and best regards,
Samuel

@samuel-lobby samuel-lobby added the Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. label Sep 16, 2021
@Findus23
Copy link
Member

Just a wild guess:
Is your iFrame embedded into a different domain as the one Matomo uses and do you have a browser with third party cookies disabled (like Chrom(e|ium) by default?

@samuel-lobby
Copy link
Author

The Matomo is used on a subdomain of the main domain.
I first thought it was the cookie banner, but that doesn't seem to be the problem. I set these two necessary cookies:

  • MATOMO_SESSID
  • mtm_consent_removed

In Matomo I deactivated tracking with cookies maybe that's also an important information.

@tsteur
Copy link
Member

tsteur commented Sep 19, 2021

Is there any chance you could post a URL to the page where we can reproduce this? It be otherwise hard to reproduce or guess what the problem might be @samuel-lobby

@samuel-lobby
Copy link
Author

@tsteur sure, here is the link to the privacy policy: https://www.hs-doepfer.de/datenschutz
Here I've implemented the opt out iframe. I hope this can be clarified as soon as possible.

@tsteur
Copy link
Member

tsteur commented Sep 20, 2021

Tested eg https://analytics.hs-doepfer.de/index.php?module=CoreAdminHome&action=optOut&language=de&setCookieInNewWindow=1&nonce=NONCE&time=1632171100302

It was trying to set an ignore cookie
image

but it wasn't set afterwards somehow. Nothing related in the logs, no issues.

Not sure what the problem might be.

@samuel-lobby I think you might not be using the latest version of Matomo? Is there any chance you could upgrade to see if that fixes it maybe?

@samuel-lobby
Copy link
Author

@tsteur I use Matomo 4.4.1. I made the update to this version after I recognized that this opt out iframe isn't working as it should. So maybe the cookie matomo_ignore is blocked from the cookie consent mananger?

@Findus23
Copy link
Member

@tsteur After checking myself, I noticed the reason why the cookie isn't set: The expiration date is expires=Mon, 09-Aug-1915 07:50:25 GMT; secure; SameSite=None.

@samuel-lobby
Copy link
Author

@Findus23 you're right. Why is this happening? Can I control this expiration date?

@Findus23
Copy link
Member

Matomo sets the expiration date to 30 years from now:

$thiryYears = time() + (86400 * 365 * 30);

So for a starter you could check the output of this PHP script:

<?php
var_dump(time());
var_dump(time() + (86400 * 365 * 30));

@Findus23
Copy link
Member

Findus23 commented Sep 21, 2021

But it is most likely a 32 bit overflow somewhere:
30 years from now is 2578918957 in unix time.
2578918957- 2^32 = -1716048339 and -1716048339 in unix time is in August 1915.

So can you describe your server setup a bit more? Which operating system are you using? Which PHP version?

@samuel-lobby
Copy link
Author

@Findus23
the crm system: TYPO3 (9.5)
PHP version: 7.2.34
The Website is hosted at Domainfactory.
Do you need some more infos?

@tsteur
Copy link
Member

tsteur commented Sep 21, 2021

I suppose this means we might also need to change other places? If I see this right the only thing we maybe can do about this add a system check mentioning 64 bit system / PHP required?

We could possibly make it work for this particular case to generate a date in 30+ years using something like str_replace('current year', 'current year +30 years', Date::now()->getDatetime()) if we could pass string as expires in the cookie method.

But generally there might be other places where there are also issues?

@tsteur tsteur added Bug For errors / faults / flaws / inconsistencies etc. and removed Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. labels Sep 21, 2021
@tsteur tsteur added this to the 4.7.0 milestone Sep 21, 2021
@samuel-lobby
Copy link
Author

@tsteur what can I do in the meantime? Or do I have to wait until it's released with an update of matomo?

@tsteur tsteur added the Help wanted Beginner friendly issues or issues where we'd highly appreciate community's help and involvement. label Sep 23, 2021
@tsteur
Copy link
Member

tsteur commented Sep 23, 2021

@samuel-lobby is there any chance you can ask your hoster if they can update your site to a 64 bit system?

To fix this specific issue maybe we can refactor the opt out cookie to calculate 30 years in the future differently instead of using a timestamp etc use something like this (pseudo code) str_replace('current year', 'current year +30 years', Date::now()->getDatetime().

@tsteur tsteur modified the milestones: 4.7.0, 4.6.0 Sep 23, 2021
@tsteur tsteur changed the title Matomo iframe opt out always checked Matomo iframe opt out always checked on PHP 32 bit Oct 7, 2021
@tsteur
Copy link
Member

tsteur commented Oct 7, 2021

The goal of this issue is to make the opt out work when a PHP 32 bit is used see #18019 (comment)

@peterhashair peterhashair self-assigned this Oct 19, 2021
@justinvelluppillai justinvelluppillai changed the title Matomo iframe opt out always checked on PHP 32 bit Make the opt out work when a PHP 32 bit is used Nov 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc. Help wanted Beginner friendly issues or issues where we'd highly appreciate community's help and involvement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants