X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Ftitle%2FTitleValue.php;h=722e5ef91d2760302af04d8aa3fb568aac8691a7;hb=4d6828ef7835b7c5c5e903637fcba4bf5c487e1b;hp=18e578dbb9f92ba66d0434ec700abb090f5d915d;hpb=9b4567f4145985dc9dd0653031e02118ce90bb18;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/title/TitleValue.php b/includes/title/TitleValue.php index 18e578dbb9..722e5ef91d 100644 --- a/includes/title/TitleValue.php +++ b/includes/title/TitleValue.php @@ -59,6 +59,16 @@ class TitleValue implements LinkTarget { */ protected $interwiki; + /** + * Text form including namespace/interwiki, initialised on demand + * + * Only public to share cache with TitleFormatter + * + * @private + * @var string + */ + public $prefixedText = null; + /** * Constructs a TitleValue. * @@ -93,7 +103,8 @@ class TitleValue implements LinkTarget { // Sanity check, no full validation or normalization applied here! Assert::parameter( !preg_match( '/^_|[ \r\n\t]|_$/', $dbkey ), '$dbkey', "invalid DB key '$dbkey'" ); - Assert::parameter( $dbkey !== '', '$dbkey', 'should not be empty' ); + Assert::parameter( $dbkey !== '' || ( $fragment !== '' && $namespace === NS_MAIN ), + '$dbkey', 'should not be empty unless namespace is main and fragment is non-empty' ); $this->namespace = $namespace; $this->dbkey = $dbkey; @@ -158,7 +169,7 @@ class TitleValue implements LinkTarget { * @return string */ public function getText() { - return str_replace( '_', ' ', $this->getDBkey() ); + return str_replace( '_', ' ', $this->dbkey ); } /**