Anonymous User Comment causes 'UID is not a number' errors
Kars-T - June 2, 2009 - 06:31
| Project: | User Stats |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
If an anonymous users posts a comment I get three errors like " UID is not a number. in /opt/drupal6-modules/user_stats/user_stats.module in Zeile 198."
If I look in line 198 it ofcourse misses the uid. If I look at your hook_comment implementation I see there ist no check if there really is a uid. Imho you should add a check if there really is one set so those messages won't appear.
Thanks!
Kars-T

#1
Me to. How can this be fixed?
#2
Wow, comment module passes a NULL value through to hook_comment() when the user is anonymous. Added a check to work around it.
#3
I've committed a fix. In a few hours the -dev package on the project homepage will be updated. Download it, try it out and re-open this bug if it isn't fixed.
Thanks for the report. :)
#4
I still get the error in Recent log entries - PHP. And the eror log caused by this module is HUGE. The error is not produced when a comment is posted, it is produced when navigating the site.
"
* user warning: UID is not a number. in /home/xxx/public_html/sites/all/modules/user_stats/user_stats.module on line 88.
* user warning: UID is not a number. in /home/xxx/public_html/sites/all/modules/user_stats/user_stats.module on line 198.
* user warning: UID is not a number. in /home/xxx/public_html/sites/all/modules/user_stats/user_stats.module on line 239.
* user warning: UID is not a number. in /home/xxx/public_html/sites/all/modules/user_stats/user_stats.module on line 198.
* user warning: UID is not a number. in /home/xxx/public_html/sites/all/modules/user_stats/user_stats.module on line 88.
* user warning: UID is not a number. in /home/xxx/public_html/sites/all/modules/user_stats/user_stats.module on line 198.
* user warning: UID is not a number. in /home/xxx/public_html/sites/all/modules/user_stats/user_stats.module on line 239.
* user warning: UID is not a number. in /home/xxx/public_html/sites/all/modules/user_stats/user_stats.module on line 198.
* user warning: UID is not a number. in /home/xxx/public_html/sites/all/modules/user_stats/user_stats.module on line 88.
* user warning: UID is not a number. in /home/xxx/public_html/sites/all/modules/user_stats/user_stats.module on line 198.
* user warning: UID is not a number. in /home/xxx/public_html/sites/all/modules/user_stats/user_stats.module on line 239.
* user warning: UID is not a number. in /home/xxx/public_html/sites/all/modules/user_stats/user_stats.module on line 198.
* user warning: UID is not a number. in /home/xxx/public_html/sites/all/modules/user_stats/user_stats.module on line 88.
* user warning: UID is not a number. in /home/xxx/public_html/sites/all/modules/user_stats/user_stats.module on line 198.
* user warning: UID is not a number. in /home/xxx/public_html/sites/all/modules/user_stats/user_stats.module on line 635.
* user warning: UID is not a number. in /home/xxx/public_html/sites/all/modules/user_stats/user_stats.module on line 239.
* user warning: UID is not a number. in /home/xxx/public_html/sites/all/modules/user_stats/user_stats.module on line 198.
* user warning: UID is not a number. in /home/xxx/public_html/sites/all/modules/user_stats/user_stats.module on line 88.
* user warning: UID is not a number. in /home/xxx/public_html/sites/all/modules/user_stats/user_stats.module on line 198.
* user warning: UID is not a number. in /home/xxx/public_html/sites/all/modules/user_stats/user_stats.module on line 239.
* user warning: UID is not a number. in /home/xxx/public_html/sites/all/modules/user_stats/user_stats.module on line 198.
* user warning: UID is not a number. in /home/xxx/public_html/sites/all/modules/user_stats/user_stats.module on line 88.
* user warning: UID is not a number. in /home/xxx/public_html/sites/all/modules/user_stats/user_stats.module on line 198.
* user warning: UID is not a number. in /home/xxx/public_html/sites/all/modules/user_stats/user_stats.module on line 635.
"
#5
I said that the error apears only in Recent log entries - PHP but it apears on the site to the visitor too.
#6
#7
Another attempt at fixing, comment.module was giving us a NULL value in a couple of other places. I've added checks to fix those specific conditions, but there may be more errors lurking that I haven't discovered yet.
Please set the status back to 'Active' if the problem persists (and provide some information on what circumstances are causing it). Thanks. :)
#8
Automatically closed -- issue fixed for 2 weeks with no activity.