Merge "Rename BlockRestriction -> BlockRestrictionStore and wire it up as a service"
[lhc/web/wiklou.git] / includes / title / TitleValue.php
index 43a399a..722e5ef 100644 (file)
@@ -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;