I regulary get this notice:
Notice: Undefined index: nid in main() (line 18 of xxxx/modules/statistics/statistics.php)

I found out this happens whith requests like this:
an ip-address - - [11/May/2015:10:42:05 +0200] "OPTIONS /modules/statistics/statistics.php HTTP/1.1" 200 304 "http://xxxx" ......

There is no problem when it is a POST request.

Comments

AlexKirienko’s picture

Status: Active » Needs review
StatusFileSize
new1.56 KB

I have faced same issue. Regular notice messages in watchdog.

Please check attached patch with fix.

mrded’s picture

Version: 7.37 » 7.x-dev

The same issue.

promes’s picture

Thanks. The code seems correct to me.

silios’s picture

Patch rectifies the problem. Thanks

timmillwood’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me!

timmillwood’s picture

David_Rothstein’s picture

Title: Undefined index: nid in main() (line 18 » Undefined index: nid in main() in statistics.php
Status: Reviewed & tested by the community » Fixed

Committed to 7.x - thanks!

Looks like this was fixed elsewhere and in a different way in Drupal 8. And we can probably live without a test for something like this.

  • David_Rothstein committed 6901ef7 on 7.x
    Issue #2486643 by AlexKirienko: Undefined index: nid in main() in...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.