Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 292206

Prevent the use of placeholders that cannot be converted into strings when creating logs

$
0
0

Problem/Motivation

If a module logs an error and one of the context are not convertible into a string, dblog the page crashes with an exception. To recover from this issue I have first truncated the dblog table and than cleared all caches as the truncate was not enough.

Proposed resolution

LogMessageParser::parseMessagePlaceholders(), which is called by the dblog and syslog loggers, should exclude any non-stringable placeholders, as the PSR-3 logging standard states that "the array can contain anything. Implementors MUST ensure they treat context data with as much lenience as possible. A given value in the context MUST NOT throw an exception nor raise any php error, warning or notice."

Proposed in #21 raise an exception when trying to write a log with placeholders that cannot converted into strings. Also, if possible, try to indicate where this error was produced as part of the raised exception. #52

Remaining tasks

None

User interface changes

None

API changes

None


Viewing all articles
Browse latest Browse all 292206

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>