When using Message::text to transform wikitext from messages (expand {{), the global title is not used, when no title is provided for the message.
This is a different behaviour as done in MessageCache::parse when using Message::parse.
It should act the same to avoid that BadTitle/Missing from the Parser is showing in the result.
This should be logged as well to GlobalTitleFail.
When a message with a correct title gets processed via MessageCache::transform the title is reused from the parser for the next parse without a title.
# php maintenance\run.php eval > echo wfMessage( (new RawMessage( '$1' ))->params( '{{PAGENAME}}' ) )->text(); Badtitle/Missing > echo wfMessage( (new RawMessage( '$1' ))->params( '{{PAGENAME}}' ) )->page( Title::newMainpage() )->text(); Main Page > echo wfMessage( (new RawMessage( '$1' ))->params( '{{PAGENAME}}' ) )->text(); Main Page