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

wad - June 13, 2009 - 05:23

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, or a:[stuff] for an array.

#2

wad - June 13, 2009 - 05:50
Project:Views Slideshow» jQ
Version:6.x-1.0-beta2» 6.x-1.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 $variables array. http://api.drupal.org/api/function/watchdog/6

#3

wad - June 17, 2009 - 11:02
Status:active» needs review

Here's a patch to fix the watchdog calls in jq/jq.add.inc so they're D6 style instead of D5 style.

AttachmentSize
jq_add_watchdog_apifix.patch 1.54 KB

#4

Sidra Kazmi - July 5, 2009 - 20:22

Can you please tell how to use this patch? I mean in which file should i copy this code to??

Cheers,

#5

wad - July 7, 2009 - 16:00

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

guix - August 28, 2009 - 11:02
Status:needs review» reviewed & tested by the community

Thanks for the patch, I guess it should be committed !

#7

guix - August 28, 2009 - 12:51
Title:Views Slideshow causes syslog errors» Watchdog calls causes syslog errors

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

guix - August 28, 2009 - 13:28

#545884: Watchdog signature in jq.add.inc is a duplicate. Please commit to fix those D5-like Watchdog calls !

 
 

Drupal is a registered trademark of Dries Buytaert.