comparison core/lib/Drupal/Core/Logger/LogMessageParser.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 4c8ae668cc8c
children
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
14 $variables = []; 14 $variables = [];
15 $has_psr3 = FALSE; 15 $has_psr3 = FALSE;
16 if (($start = strpos($message, '{')) !== FALSE && strpos($message, '}') > $start) { 16 if (($start = strpos($message, '{')) !== FALSE && strpos($message, '}') > $start) {
17 $has_psr3 = TRUE; 17 $has_psr3 = TRUE;
18 // Transform PSR3 style messages containing placeholders to 18 // Transform PSR3 style messages containing placeholders to
19 // \Drupal\Component\Utility\SafeMarkup::format() style. 19 // \Drupal\Component\Render\FormattableMarkup style.
20 $message = preg_replace('/\{(.*)\}/U', '@$1', $message); 20 $message = preg_replace('/\{(.*)\}/U', '@$1', $message);
21 } 21 }
22 foreach ($context as $key => $variable) { 22 foreach ($context as $key => $variable) {
23 // PSR3 style placeholders. 23 // PSR3 style placeholders.
24 if ($has_psr3) { 24 if ($has_psr3) {
28 if (strpos($message, '@' . $key) !== FALSE) { 28 if (strpos($message, '@' . $key) !== FALSE) {
29 $key = '@' . $key; 29 $key = '@' . $key;
30 } 30 }
31 } 31 }
32 if (!empty($key) && ($key[0] === '@' || $key[0] === '%' || $key[0] === '!')) { 32 if (!empty($key) && ($key[0] === '@' || $key[0] === '%' || $key[0] === '!')) {
33 // The key is now in \Drupal\Component\Utility\SafeMarkup::format() style. 33 // The key is now in \Drupal\Component\Render\FormattableMarkup style.
34 $variables[$key] = $variable; 34 $variables[$key] = $variable;
35 } 35 }
36 } 36 }
37 37
38 return $variables; 38 return $variables;