X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;ds=inline;f=includes%2FMessage.php;h=2a55d0ee748f54b138bb470fa1e184dc34c21063;hb=5120937028f768749d058aa91dde82a96de0af1c;hp=8777c6fee141829b2887f906e4227c9a329bec68;hpb=ace44e2064851dda9d9e7327494bd7b7b3379825;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Message.php b/includes/Message.php index 8777c6fee1..2a55d0ee74 100644 --- a/includes/Message.php +++ b/includes/Message.php @@ -1167,11 +1167,17 @@ class Message implements MessageSpecifier, Serializable { } elseif ( isset( $param['list'] ) ) { return $this->formatListParam( $param['list'], $param['type'], $format ); } else { - $warning = 'Invalid parameter for message "' . $this->getKey() . '": ' . - htmlspecialchars( serialize( $param ) ); - trigger_error( $warning, E_USER_WARNING ); - $e = new Exception; - wfDebugLog( 'Bug58676', $warning . "\n" . $e->getTraceAsString() ); + if ( !is_scalar( $param ) ) { + $param = serialize( $param ); + } + \MediaWiki\Logger\LoggerFactory::getInstance( 'Bug58676' )->warning( + 'Invalid parameter for message "{msgkey}": {param}', + [ + 'exception' => new Exception, + 'msgkey' => $this->getKey(), + 'param' => htmlspecialchars( $param ), + ] + ); return [ 'before', '[INVALID]' ]; } @@ -1344,56 +1350,3 @@ class Message implements MessageSpecifier, Serializable { return $this->extractParam( new RawMessage( $vars, $params ), $format ); } } - -/** - * Variant of the Message class. - * - * Rather than treating the message key as a lookup - * value (which is passed to the MessageCache and - * translated as necessary), a RawMessage key is - * treated as the actual message. - * - * All other functionality (parsing, escaping, etc.) - * is preserved. - * - * @since 1.21 - */ -class RawMessage extends Message { - - /** - * Call the parent constructor, then store the key as - * the message. - * - * @see Message::__construct - * - * @param string $text Message to use. - * @param array $params Parameters for the message. - * - * @throws InvalidArgumentException - */ - public function __construct( $text, $params = [] ) { - if ( !is_string( $text ) ) { - throw new InvalidArgumentException( '$text must be a string' ); - } - - parent::__construct( $text, $params ); - - // The key is the message. - $this->message = $text; - } - - /** - * Fetch the message (in this case, the key). - * - * @return string - */ - public function fetchMessage() { - // Just in case the message is unset somewhere. - if ( $this->message === null ) { - $this->message = $this->key; - } - - return $this->message; - } - -}