Problem/Motivation

In multiple places, watchdog() is called with incorrect arguments. In one case this is generating a fatal error when the resulting watchdog message is displayed:

Recoverable fatal error: Argument 2 passed to t() must be of the type array, string given, called in /path/to/site/code/modules/dblog/dblog.admin.inc on line 295 and defined in t() (line 1755 of /path/to/site/code/includes/bootstrap.inc).

This error comes from the line:

watchdog('sendgrid_integration', t('No API Secret key has been set'), 'warning');

The 'warning' should be the third and not the second argument.

Other faulty watchdog entries include:

  • Ones in this form:
    watchdog('SendGrid Integration', 'Error on calling get_bounches: Missing date parameter', NULL, WATCHDOG_NOTICE, $link = NULL);
    

    Final , $link = NULL should be deleted.

  • Ones in this form:
    watchdog('sendgrid_integration_reports', t('Sendgrid Module is not setup with API key.'), array(), 'WATCHDOG_NOTICE', NULL);
    

    t() should not be called on the second argument.
    The constant WATCHDOG_NOTICE should not be in quotes.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Comments

nedjo created an issue. See original summary.

nedjo’s picture

Issue summary: View changes

  • Perignon committed 631dd90 on 7.x-1.x
    git commit -m 'Issue #2859670: Incorrect usage of watchdog() in multiple...
Perignon’s picture

Status: Active » Fixed

Fixed! Thanks for pointing out the inconsistencies.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.