X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FMessage.php;h=85c78d640cc86566ee02fbec4f82c713cfe44a79;hb=01ca3f90cdf7ff1c8f399c2af3ab97599fcc3c84;hp=7d86d07517f566e8d83cadee54180b7df2f02854;hpb=5111bd2def4e63ecc8a2acbf468e5c39029f9efd;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Message.php b/includes/Message.php index 7d86d07517..85c78d640c 100644 --- a/includes/Message.php +++ b/includes/Message.php @@ -766,6 +766,7 @@ class Message implements MessageSpecifier, Serializable { */ public function useDatabase( $useDatabase ) { $this->useDatabase = (bool)$useDatabase; + $this->message = null; return $this; } @@ -1132,10 +1133,27 @@ class Message implements MessageSpecifier, Serializable { return [ 'before', '[INVALID]' ]; } } elseif ( $param instanceof Message ) { + // Match language, flags, etc. to the current message. + $msg = clone $param; + if ( $msg->language !== $this->language || $msg->useDatabase !== $this->useDatabase ) { + // Cache depends on these parameters + $msg->message = null; + } + $msg->interface = $this->interface; + $msg->language = $this->language; + $msg->useDatabase = $this->useDatabase; + $msg->title = $this->title; + + // DWIM + if ( $format === 'block-parse' ) { + $format = 'parse'; + } + $msg->format = $format; + // Message objects should not be before parameters because // then they'll get double escaped. If the message needs to be // escaped, it'll happen right here when we call toString(). - return [ 'after', $param->toString( $format ) ]; + return [ 'after', $msg->toString( $format ) ]; } else { return [ 'before', $param ]; }