@l36t opened this Issue on August 30th 2016

my apache error.log sometimes print:
PHP Warning: Invalid argument supplied for foreach() in C:\phpEnv\Apache24\htdocs\piwik\core\Tracker\RequestSet.php on line 38

I use piwik 2.16.1,php5.5.36,how to resolve this problem,does this warning affect collecting data?

@mattab commented on September 27th 2016 Member

Thanks for the report @l36t - do you know how to reproduce this issue? if we can reproduce it we will be able to fix it. Thanks for sending more information....

for example maybe you could find the request from your webserver access log that triggered this error ?

@mattab commented on November 11th 2016 Member

@l36t please see previous comment, can you send the HTTP request in your access.log file, that has triggered this error? (you can find it by looking at the datetime of the error and finding back the request that was made at the same second or one-two seconds before)

@pardvm commented on February 21st 2017

Hi @mattab ,
I'm experiencing same problem: I get about 2500 php warnings:

grep "PHP Warning" error_log |wc -l
2482

like this one:

[Tue Feb 21 21:10:26.535362 2017] [php7:warn] [pid 16922:tid 140190181963520] [client 181.196.76.228:59504] PHP Warning: Invalid argument supplied for foreach() in /datos/httpd-pwk-2.4.25/htdocs/analytics/core/Tracker/RequestSet.php on line 38, referer: http://www.extra.ec/actualidad/elecciones2017-resultados-votaciones-actualidad-DD1104603

The requests "surrounding" that error are attached in the following file:
piwik.requests.txt

Please, let me know if you need more information: I'm wondering if this could imply to lost hits

Thank you in advance.

@wmtech-1 commented on May 9th 2018

I have the same problem with the same error message and use the most recent version 3.5.0. It may have something to do with log importing.

It looks like you need to make sure that $requests in line 38 is definitely an array before feeding the var to foreach().

[09-May-2018 17:39:49 UTC] PHP Warning: Invalid argument supplied for foreach() in /home/nginx/public/core/Tracker/RequestSet.php on line 38 [09-May-2018 17:39:57 UTC] PHP Warning: Invalid argument supplied for foreach() in /home/nginx/public/core/Tracker/RequestSet.php on line 38 [09-May-2018 17:40:03 UTC] PHP Warning: Invalid argument supplied for foreach() in /home/nginx/public/core/Tracker/RequestSet.php on line 38 [09-May-2018 17:40:10 UTC] PHP Warning: Invalid argument supplied for foreach() in /home/nginx/public/core/Tracker/RequestSet.php on line 38 [09-May-2018 17:40:17 UTC] PHP Warning: Invalid argument supplied for foreach() in /home/nginx/public/core/Tracker/RequestSet.php on line 38 [09-May-2018 17:40:32 UTC] PHP Warning: Invalid argument supplied for foreach() in /home/nginx/public/core/Tracker/RequestSet.php on line 38 [09-May-2018 17:40:46 UTC] PHP Warning: Invalid argument supplied for foreach() in /home/nginx/public/core/Tracker/RequestSet.php on line 38 [09-May-2018 17:41:01 UTC] PHP Warning: Invalid argument supplied for foreach() in /home/nginx/public/core/Tracker/RequestSet.php on line 38 [09-May-2018 17:41:01 UTC] PHP Warning: Invalid argument supplied for foreach() in /home/nginx/public/core/Tracker/RequestSet.php on line 38 [09-May-2018 17:42:05 UTC] PHP Warning: Invalid argument supplied for foreach() in /home/nginx/public/core/Tracker/RequestSet.php on line 38

@sgiehl commented on May 9th 2018 Member

Are you able to produce a stack trace for that error? would be good to know where the empty requestset comes from, as that might be the main problem

@wmtech-1 commented on May 10th 2018

Sorry, no. We cannot fiddle with the live installation and I it seems the error is not easy to reproduce in a test environment.

Maybe I can add a simple log to dump the var if the error happens ...

Powered by GitHub Issue Mirror