When I use honeypot in conjunction with logging_alerts, I get the following exceptions in my logs:

InvalidArgumentException: $string ("Blocked submission of %form due to @cause.") must be a string. in Drupal\Core\StringTranslation\TranslatableMarkup->__construct() (line 133 of core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php).

I think the problem is that honeypot is invoking \Drupal::logger()->notice() with an already-translated message, whereas the \Psr\Log\LoggerInterface methods expect untranslated messages.

Comments

smokris created an issue. See original summary.

smokris’s picture

Assigned: smokris » Unassigned
Status: Active » Needs review
StatusFileSize
new583 bytes

Patch attached.

Status: Needs review » Needs work

The last submitted patch, 2: log-messages-double-escaped-3010364-2.patch, failed testing. View results

smokris’s picture

Status: Needs work » Needs review
StatusFileSize
new587 bytes
smokris’s picture

Issue summary: View changes
tr’s picture

Version: 8.x-1.x-dev » 2.0.x-dev
Status: Needs review » Reviewed & tested by the community

Yes, this is a bug. The Logger should not be using t() in this manner. The patch is the correct way to fix this.

To be clear, this has nothing to do with the logging_alerts module - Honeypot is calling Logger::notice() with the wrong parameters.

Patch applies both to the 2.0.x branch and to the 8.x-1.x branch. As per usual Drupal practice, this should be addressed in the current 2.0.x branch first then should be backported to 8.x-1.x.

  • TR committed 3784130 on 2.0.x authored by smokris
    Issue #3010364 by smokris: Log messages double-escaped ("...

  • TR committed 67a9406 on 8.x-1.x authored by smokris
    Issue #3010364 by smokris: Log messages double-escaped ("...
tr’s picture

Status: Reviewed & tested by the community » Fixed

Committed and cherry-picked back to 8.x-1.x.

Status: Fixed » Closed (fixed)

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