This is a bug report related to http://drupal.org/node/876646, but this isn't about the Devel or profile module.
I have the same error popping up in my Drupal 6 logs. Every time I refresh the logs IF there's a certain kind of entry (which I'll explain below), I get the following error (which naturally goes to the top of the error log):
"warning: Invalid argument supplied for foreach() in /home/myuserID/domains/mysiteexample.com/public_html/includes/common.inc on line 928.
warning: strtr() [function.strtr]: The second argument is not an array in /home/myuserID/domains/mysiteexample.com/public_html/includes/common.inc on line 945."
(See the attached image for screenshots of this issue. Each "page" in this single screenshot is separated by a grayish blue bar.)
Every time there's a user entry of with no link in the Message field, the error occurs. At the top of the "page 1" (a screenshot of /admin/reports/dblog?page=5), the two errors above are repeated five times (a total of 10 entries). On "page 2" - a clipped up screenshot of the same web page only further down, there are five user entries WITH NOTHING IN THE MESSAGE FIELD. On "page 3", you'll see the same web page after it has been refreshed, and the 10 new errors have been added to the front of the log. Those errors have pushed 3 of those 5 user entries, and now only 4 new errors have occurred (see "page 4" for the same log entries below this.) Pages "5" and "6" in the screenshot are what you get when you individual entries. Page "6" is a normal entry that NOT one of the five and does not cause an error. Page "5" is an entry that you get when you manually edit the URL to see the details of the error (you can't just click on it because the link is gone so you change the error number to 12345 - example - http://mysite.com/admin/reports/event/12345). In that screenshot, you see that going to the user entry without the message field adds yet another two entries of the same errors to the error log.
I'm not a Drupal core developer, so I can only guess, but my guess is that something is wrong with the Message field being empty and not populating an array of some kind in common.inc. I also have no idea why those Message fields are coming up empty for those user entries.
| Comment | File | Size | Author |
|---|---|---|---|
| 20100825_D6_research.png | 85.09 KB | aubjr_drupal |
Comments
Comment #1
greg.harvey+1, I'm getting this for some reason. Straight after an update to 6.19 I went to the dblog and got these messages. Caches cleared, db updates run, etc. Weird. =/
Comment #2
bramface commentedI've got them, too. Very little on the boards about this pair:
I'm using Storm - that's the only rare thing about this site. Are you?
-Bram
Comment #3
greg.harveyNope, normal Drupal.
Comment #4
Starminder commentedsubscribe
Comment #5
djhspence commentedI have pretty much the same problem, but so far I've only seen the error on one page (/admin/by-module)
Error:
Comment #6
truple commentedI have the problem described here, and have investigated a number of the behaviors in my Drupal instance. I don't have a terribly high amount of experience with mucking around in the core, so bear with me.
I modified common.inc to report the value of $args to admin/reports/dblog and noticed that in my case it had a value of 7 with type of integer instead of the expected type of array.
So to recap, the error on line 928 is caused by calling a foreach loop on something that isn't an array, and the error on 945 is caused by trying to pass an integer on to the strtr function when it expects an array.
I tested out a quick fix by wrapping the foreach loop that starts on 928 in a conditional check for $args to make sure it's an array. In the case that $args is not an array I set it equal to array().
This seems to keeps the errors from happening and suppresses the toxic messages from admin/reports/dblog.
As I said before I don't have much experience with the Drupal core, so I wouldn't recommend doing this on a site you care about until someone with more experience has a look. The main reason being I don't know what else it might screw up.
Comment #7
skylord commentedsubscribe
Comment #8
arski commentedsub
Comment #9
anil614sagar commentedHi Guys,
This error comes because if any module uses t function something like below.
t('Edit @number characterstic', $number);
Which should be
t('Edit @number characterstic', array("@number" => 2));
Cheers,
Anil Sagar