Issue #2807743 by alexpott, catch, kiamlaluno, neclimdul, xjm: Switch from...
Issue #2807743 by alexpott, catch, kiamlaluno, neclimdul, xjm: Switch from deprecation notice to warning for non-standard placeholders in FormattableMarkup::placeholderFormat()
// Remove 'severity_level' as is not a valid replacement for t().
$severity=$error['severity_level'];
unset($error['severity_level']);
// Backtrace array is not a valid replacement value for t().
$backtrace=$error['backtrace'];
unset($error['backtrace']);
@@ -166,8 +170,10 @@ function _drupal_log_error($error, $fatal = FALSE) {
// installer.
if(\Drupal::hasService('logger.factory')){
try{
// Provide the PHP backtrace to logger implementations.
\Drupal::logger('php')->log($error['severity_level'],'%type: @message in %function (line %line of %file) @backtrace_string.',$error+['backtrace'=>$backtrace]);
// Provide the PHP backtrace to logger implementations. Add
// 'severity_level' to the context to maintain BC and allow logging
// implementations to use it.
\Drupal::logger('php')->log($severity,'%type: @message in %function (line %line of %file) @backtrace_string.',$error+['backtrace'=>$backtrace,'severity_level'=>$severity]);
}
catch(\Exception$e){
// We can't log, for example because the database connection is not
@trigger_error(sprintf('Support for keys without a placeholder prefix is deprecated in Drupal 9.1.0 and will be removed in Drupal 10.0.0. Invalid placeholder (%s) with string: "%s"',$key,$string),E_USER_DEPRECATED);
}
elseif(strpos($string,$key)!==FALSE){
trigger_error('Invalid placeholder ('.$key.') in string: '.$string,E_USER_DEPRECATED);
else{
trigger_error(sprintf('Invalid placeholder (%s) with string: "%s"',$key,$string),E_USER_WARNING);
}
// No replacement possible therefore we can discard the argument.