Closed (duplicate)
Project:
Drupal core
Version:
7.x-dev
Component:
dblog.module
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
4 Dec 2018 at 13:17 UTC
Updated:
16 May 2022 at 21:11 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
adhariwal commentedComment #3
neeravbm commentedAre you sure this is not coming from custom code where instead of passing second argument as an array to t() function, an integer is being passed?
Comment #4
adhariwal commented@neeravbm Nope, it coming from dblog module only if you observe this line `$output = t($event->message, unserialize($event->variables))` you can easily understand that the second argument was not passed as an array here. I replaced the line with `t($event->message, [unserialize($event->variables)]);` which worked fine.
Comment #5
adhariwal commentedComment #6
berdirIt might call it, but this indicates that someone incorrectly used the watchdog() API and provided an integer instead of an array there.
It could maybe do better validation of those values, but this fix is definitely wrong and would break all proper calls.
Check which module logged this row, then look for the problem there and clear your dblog to have it working again.
Comment #7
purushotam.rai commentedUsing the above patch breaks all other database logging, I guess we need to check before adding the array parenthesis.
Comment #8
alexmoreno commentedComment #10
jacob.embree commentedThere is a lot of discussion about the arguments to
watchdog()at #1279680: watchdog() does not type its array arguments and the related issues, and it certainly seems to be a problem with a calling module, not with dblog orwatchdog().I agree with Berdir that this is a support request and her answer covers it, so this can be marked "Fixed".
Both patches are incompatible with PHP 5.3 anyway.
Comment #11
alexmoreno commentedchanging the status to closed (works as designed) to avoid confusion, as the patches won't be merged.
Summarising, custom code is responsible of this, so it should be that custom code calling dblog which should be fixed.
Comment #12
tinoscho commentedHi,
today I (again) stumbled upon this problem. I recognize that the problem is that the caller is using the API in a wrong way. Yet, the db_log exists to protocol and find problems in the system - which is quite difficult when the log cannot be used at all.
Therefore I suggest the attached patch - which I think is a quite safe and defense way to make at least sure the dblog can be viewed even if the callers are handling the API in a wrong way.
I'd be very happy if you could integrate that patch in future versions of D7.
Tino
Comment #13
tinoscho commentedHi,
please find attached a new version of the patch without trailing whitespace...
Tino
Comment #14
bburgI was running into this today, You can pretty quickly see what might be causing this by looking at the watchdog table directly:
In my case, I had something like this in the variables column:
In some custom code, I had confused the 3rd and 4th arguments in watchdog. https://api.drupal.org/api/drupal/includes%21bootstrap.inc/function/watc..., the 3rd being the variables added into the message, and 4th being the error severity.
The third argument should be an array, but I had passed an integer corresponding with the constant WATCHDOG_ERROR. As a long time watcher of this issue #1279680: watchdog() does not type its array arguments, I know it's unlikely that this will be changed.
Comment #15
bobburns commentedNeeds to be comitted to core - patch 13 fixes this error which is still occurring, and my logging has contined with it applied
Comment #16
poker10 commentedI think this is a duplicate of #2790857: Log completely unusable when an entry has corrupt serialized data (D7). Patches here have the same intention to fix the watchdog output in
theme_dblog_message(), not thewatchdog()function itself as in #1279680: watchdog() does not type its array arguments. Also this issue is newer than the first mentioned.