Watchdog calls causes syslog errors
wad - June 13, 2009 - 05:06
| Project: | jQ |
| Version: | 6.x-1.2 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | reviewed & tested by the community |
Description
Whenever I enable the Views Slideshow module, I get an error message at the top of every page saying
warning: strtr() [function.strtr]: The second argument is not an array in [path to]/htdocs/modules/syslog/syslog.module on line 106.
#1
Looking at mysql, I find the watchdog table is not handled correctly:
mysql> select message,variables from watchdog where type='jq';+--------------------------------------------------+-----------+
| message | variables |
+--------------------------------------------------+-----------+
| The <em>cycle</em> jQuery plugin is not defined. | i:3; |
| The <em>cycle</em> jQuery plugin is not defined. | i:3; |
...
| The <em>cycle</em> jQuery plugin is not defined. | i:3; |
+--------------------------------------------------+-----------+
48 rows in set (0.00 sec)
The variables column should contain either
N;for null, ora:[stuff]for an array.#2
Enabling http://drupal.org/project/jquery_plugin and deleting the rows from the watchdog prevents this error being logged.
I think the bug is actually in jQ module:
<?php// log & display an error, but only if we haven't already. don't want to overwhelm with a lot of identical errors per page
$error = t('The %plugin jQuery plugin is not defined.', array('%plugin' => $plugin));
if ($log_errors) {
watchdog('jq', $error, WATCHDOG_ERROR);
}
?>
Instead of WATCHDOG_ERROR, the watchdog function is expecting a
$variablesarray. http://api.drupal.org/api/function/watchdog/6#3
Here's a patch to fix the watchdog calls in
jq/jq.add.incso they're D6 style instead of D5 style.#4
Can you please tell how to use this patch? I mean in which file should i copy this code to??
Cheers,
#5
Er, apply it the same as any other patch. See http://drupal.org/patch/apply for example
$ cd sites/all/modules$ wget http://drupal.org/files/issues/jq_add_watchdog_apifix.patch
$ patch -p0 < jq_add_watchdog_apifix.patch
patching file jq/jq.add.inc
#6
Thanks for the patch, I guess it should be committed !
#7
Changing the title, because the patch resolves the issue of the bad watchdog calls.
With the patch the error is correctly logged but it's still there : The cycle jQuery plugin is not defined., see #562196: Error : the cycle jQuery plugin is not defined
#8
#545884: Watchdog signature in jq.add.inc is a duplicate. Please commit to fix those D5-like Watchdog calls !