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.
CommentFileSizeAuthor
#3 jq_add_watchdog_apifix.patch1.54 KBwaddles

Comments

waddles’s picture

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.

waddles’s picture

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:

      // 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

waddles’s picture

Status: Active » Needs review
StatusFileSize
new1.54 KB

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

Sidra Kazmi’s picture

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

Cheers,

waddles’s picture

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
guillaumeduveau’s picture

Status: Needs review » Reviewed & tested by the community

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

guillaumeduveau’s picture

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

guillaumeduveau’s picture

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

ball.in.th’s picture

Subscribing. I am running into strange errors in dblog because of this bug too! Patch in #3 looks good.