I am getting the following errors just accessing admin/reports/dblog

I am Drupal 6.8, MYSQL 5.0.67, PHP5.2.6,
Webserver-Apache/2.2.11 (Unix) PHP/4.4.9 mod_ssl/2.2.11 OpenSSL/0.9.8c mod_fastcgi/2.4.6 Phusion_Passenger/2.0.5 DAV/2 SVN/1.4.2

Error:

    * warning: Invalid argument supplied for foreach() in /home/...../..../includes/common.inc on line 883.
    * warning: strtr() [function.strtr]: The second argument is not an array in /home/i..../../includes/common.inc on line 900.

I also see the following errors logged:

Type	php
Date	Saturday, January 10, 2009 - 11:56
User	Hilal
Location	http://www..../admin/reports/dblog
Referrer	http://www.../admin
Message	strtr() [<a href='function.strtr'>function.strtr</a>]: The second argument is not an array in /home/.../.../includes/common.inc on line 900.
Severity	error

Comments

batigolix’s picture

same here:

error on http://mysite/drupal6/admin/reports/dblog

warning: Invalid argument supplied for foreach() in /var/www/drupal-6.8-test/includes/common.inc on line 883.
warning: strtr() [function.strtr]: The second argument is not an array. in /var/www/drupal-6.8-test/includes/common.inc on line 900.

error logged:

Details
Type php
Date Monday, January 12, 2009 - 09:35
User joop
Location http://234.170.200.25/drupal6/admin/reports/dblog
Referrer http://234.170.200.25/drupal6/admin/reports/dblog
Message strtr() [function.strtr]: The second argument is not an array. in /var/www/drupal-6.8-test/includes/common.inc on line 900.
Severity error
Hostname 192.168.0.1
Operations

system:

Drupal 6.8
Access to update.php Protected
Configuration file Protected
Cron maintenance tasks Last run 0 sec ago
You can run cron manually.
Database updates Up to date
Drupal core update status Up to date
File system Writable (public download method)
GD library 2.0 or higher
Module and theme update status Up to date
MySQL database 5.0.32
PHP 5.2.0-8+etch13
PHP memory limit 80M
PHP register globals Disabled
Unicode library PHP Mbstring Extension
Update notifications Enabled
Web server Apache/2.2.3 (Debian) PHP/5.2.0-8+etch13

HS’s picture

Status: Closed (won't fix) » Active

The errors below are from today:

* warning: Invalid argument supplied for foreach() in /home/isla...t/islan.../includes/common.inc on line 883.
* warning: strtr() [function.strtr]: The second argument is not an array in /home/isla..et/islan..lk/includes/common.inc on line 900.
* warning: Invalid argument supplied for foreach() in /home/isla..t/islan..k/includes/common.inc on line 883.
* warning: strtr() [function.strtr]: The second argument is not an array in /home/islan..t/islandc..k/includes/common.inc on line 900.
* warning: Invalid argument supplied for foreach() in /home/islandcricket/island..lk/includes/common.inc on line 883.
* warning: strtr() [function.strtr]: The second argument is not an array in /home/islan..c..t/island...lk/includes/common.inc on line 900.
* warning: Invalid argument supplied for foreach() in /home/islan..et/islandc..lk/includes/common.inc on line 883.
* warning: strtr() [function.strtr]: The second argument is not an array in /home/islan..ket/islan....k/includes/common.inc on line 900.

Dave Reid’s picture

Status: Active » Closed (won't fix)

One of your contrib modules is not using the parameters to t() or watchdog() correctly ($args is not an array). Try disabling groups of contrib modules at a time to narrow down which module is the problem.

Damien Tournoud’s picture

Better yet, run the following query on your installation:

SELECT type, message, COUNT(*) FROM watchdog WHERE variables NOT LIKE 'a:%' AND variables != 'N;' GROUP BY type, message

That will allow you to identify which module and which call is causing the issue.

HS’s picture

Thank you for the responses guys.

Damien> How would i run that query? Sorry mate I'm a total newb at this but if you give me a few quick tips, I'm sure i'll figure it out.

Dave Reid’s picture

You can run the query in the mysql command line client, phpMyAdmin, or your preferred MySQL client. (or PostgreSQL if you use that).

HS’s picture

Thanks dave,

I got the following when i tried it:

Error

SQL query: Documentation

SELECT TYPE , message, COUNT( * )
FROM watchdog
WHERE VARIABLES NOT LIKE 'a:%'
AND VARIABLES != 'N;'
GROUP BY TYPE , message
LIMIT 0 , 30

MySQL said: Documentation
#1146 - Table 'islandcricket_db_drupal.watchdog' doesn't exist

I know your probably laughing at this point, but im totally new at this..sorry!

H

pwieck’s picture

I am getting this on 6.9 as I click different links on the admin page.

Type php
Date Monday, January 26, 2009 - 10:04am
User admin
Location http://localhost/admin/reports/dblog
Referrer http://localhost/admin/reports/status
Message strtr() [function.strtr]: The second argument is not an array in C:\xampp\htdocs\includes\common.inc on line 891.
Severity error
Hostname 127.0.0.1
Operations

Alone with this

Type php
Date Monday, January 26, 2009 - 10:04am
User admin
Location http://localhost/admin/reports/dblog
Referrer http://localhost/admin
Message Invalid argument supplied for foreach() in C:\xampp\htdocs\includes\common.inc on line 874.
Severity error
Hostname 127.0.0.1
Operations

Dave Reid’s picture

@paulwamail: Please try the query in comment #4 to see which module is causing the problem.

pwieck’s picture

I tried that before posting It was the link checker module. Uninstalled module but problem continued.

How I cleared the error: I used the backup and migration module to backup data without watchdog and cache data. Did a restore and now problem gone. I just upgraded from 5.14 so this could of been due to old link data. I have not tried to reinstall the link checker so can not report about the overall out come.

Thanks for the reply.

ps: That code snipplet is going in my drupal tool box :-)

Dave Reid’s picture

Yeah, once a module stores bad data in the watchdog table, it's still there if you uninstall the module. You'll actually have to delete the records using a SQL query like:
DELETE FROM {watchdog} WHERE type = 'problematic_module';

Damien Tournoud’s picture

@paulwamail: please open a new issue against the link checker module.

HS’s picture

Status: Closed (won't fix) » Active

I don't have link checker enabled guys.

Dave Reid’s picture

Status: Active » Closed (won't fix)

@Hilalsuhaib: Run the SQL query from #4 in your database:
SELECT type, message, COUNT(*) FROM watchdog WHERE variables NOT LIKE 'a:%' AND variables != 'N;' GROUP BY type, message;
The type column should indicate which module is the problem, then file a bug report in the issue queue of the module.

HS’s picture

Thanks Dave. Sorry I didnt mean to change the status before, I think I accidentally clicked and scrolled and it changed the option.

I ran the query and I'm getting the following

Error

SQL query: Documentation

SELECT TYPE , message, COUNT( * )
FROM watchdog
WHERE VARIABLES NOT LIKE 'a:%'
AND VARIABLES != 'N;'
GROUP BY TYPE , message
LIMIT 0 , 30

MySQL said: Documentation
#1146 - Table 'islandcricket_db_drupal.watchdog' doesn't exist

HS’s picture

Status: Active » Closed (won't fix)

I have a table called drupal_watchdog?

will changing the query to this work?

SELECT type, message, COUNT(*) FROM drupal_watchdog WHERE variables NOT LIKE 'a:%' AND variables != 'N;' GROUP BY type, message

Dave Reid’s picture

Yeah, if you have database table prefix for your drupal tables, use that in front of the 'watchdog' name. In your case, that would be drupal_watchdog.

HS’s picture

Thanks Dave.

This is what resulted after I ran the query.

MySQL returned an empty result set (i.e. zero rows). (Query took 0.0258 sec)
SQL query:
SELECT TYPE , message, COUNT( * )
FROM drupal_watchdog
WHERE VARIABLES NOT LIKE 'a:%'
AND VARIABLES != 'N;'
GROUP BY TYPE , message
LIMIT 0 , 30

----

SQL query: EXPLAIN SELECT type, message, COUNT(*) FROM drupal_watchdog WHERE variables NOT LIKE 'a:%' AND variables != 'N;' GROUP BY type, message;
Rows: 1
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE drupal_watchdog ALL NULL NULL NULL NULL 1001 Using where; Using temporary; Using filesort

geerlingguy’s picture

Thanks for the query in #4! Quite helpful!

To fix, I just emptied the watchdog table completely - didn't need any of the other data, as I'm just about to go live with the site, and will be needing fresh data :-)

royerd’s picture

Mine was the CAPTCHA module. Nothing wrong with the module, but once that error got stuck in there, it has to be deleted from the watchdog table. I found it was CAPTCHA using the query in #4. Then I went to the watchdog and serched for type=Captcha then found the offending log entry and deleted it.

I didn't need to disable the module to do this.

Dan

HS’s picture

Issue summary: View changes

removed url