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

Fatal error in tour when detecting consent manager #20077

Closed
tsteur opened this issue Dec 5, 2022 · 3 comments · Fixed by #20078
Closed

Fatal error in tour when detecting consent manager #20077

tsteur opened this issue Dec 5, 2022 · 3 comments · Fixed by #20078
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Milestone

Comments

@tsteur
Copy link
Member

tsteur commented Dec 5, 2022

The recently added tour challenge "detect consent manager" is triggering a fatal error:

Error: {"message":"explode(): Argument #2 ($string) must be of type string, array given","file":"/core/Http.php","line":759,"request_id":"aceb4","backtrace":" on /core/Http.php(759)\n#0 /core/Http.php(759): explode('\r\n', Array)\n#1 /core/SiteContentDetector.php(294): Piwik\Http::sendHttpRequestBy('curl', 'https://www....', 5, 'Mozilla/5.0 (Wi...', NULL, NULL, 0, false, true)\n#2 /core/SiteContentDetector.php(130): Piwik\SiteContentDetector->requestSiteData(1, 5)\n#3 /plugins/Tour/API.php(84): Piwik\SiteContentDetector->detectContent(Array)\n#4 [internal function]: Piwik\Plugins\Tour\API->detectConsentManager('1', 60)\n#5 /core/API/Proxy.php(244): call_user_func_array(Array, Array)\n#6 /var

URL: /index.php?date=yesterday&module=API&format=json&method=Tour.detectConsentManager&idSite=1&filter_limit=-1&segment=&period=day

@tsteur tsteur added Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. To Triage An issue awaiting triage by a Matomo core team member labels Dec 5, 2022
@bx80
Copy link
Contributor

bx80 commented Dec 5, 2022

@tsteur From the backtrace it looks like the issue is in core/Http::sendHttpRequestBy() which is failing to parse the header returned by the configured site. This could be difficult to recreate without knowing the site response. Would it be possible to share the site URL in some way?

@bx80 bx80 added the Waiting for user feedback Indicates the Matomo team is waiting for feedback from the author or other users. label Dec 5, 2022
@justinvelluppillai
Copy link
Contributor

Looks like it could actually be fixed already without knowing that by changing the default value of $headers to an empty array instead of empty string https://github.com/matomo-org/matomo/blob/4.x-dev/core/Http.php#L745

@bx80
Copy link
Contributor

bx80 commented Dec 5, 2022

Thanks @justinvelluppillai 👍 I'd spotted that but was hoping to be able to recreate the issue to confirm there were no other downstream problems in this scenario, seems like this might be a rare code path since the offending code was added back in 2013! Since this is a trivial fix I've created a quick PR.

@bx80 bx80 added Bug For errors / faults / flaws / inconsistencies etc. and removed Waiting for user feedback Indicates the Matomo team is waiting for feedback from the author or other users. Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. To Triage An issue awaiting triage by a Matomo core team member labels Dec 6, 2022
@bx80 bx80 added this to the 4.13.2 milestone Dec 6, 2022
@sgiehl sgiehl modified the milestones: 4.13.2, 4.13.1 Jan 16, 2023
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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants