Protect language converter markup in the preprocessor.
[lhc/web/wiklou.git] / includes / parser / Preprocessor.php
index 255fef8..426b550 100644 (file)
@@ -48,7 +48,13 @@ abstract class Preprocessor {
                        'names' => [ 2 => null ],
                        'min' => 2,
                        'max' => 2,
-               ]
+               ],
+               '-{' => [
+                       'end' => '}-',
+                       'names' => [ 1 => null ],
+                       'min' => 1,
+                       'max' => 1,
+               ],
        ];
 
        /**
@@ -67,9 +73,7 @@ abstract class Preprocessor {
                }
 
                $key = wfMemcKey(
-                       // TODO: Once we require PHP 5.5, use static::class instead of
-                       // get_called_class() or get_class( $this ).
-                       defined( 'static::CACHE_PREFIX' ) ? static::CACHE_PREFIX : get_called_class(),
+                       defined( 'static::CACHE_PREFIX' ) ? static::CACHE_PREFIX : static::class,
                        md5( $text ), $flags );
                $value = sprintf( "%08d", static::CACHE_VERSION ) . $tree;
 
@@ -100,9 +104,7 @@ abstract class Preprocessor {
                $cache = ObjectCache::getInstance( $config->get( 'MainCacheType' ) );
 
                $key = wfMemcKey(
-                       // TODO: Once we require PHP 5.5, use static::class instead of
-                       // get_called_class() or get_class( $this ).
-                       defined( 'static::CACHE_PREFIX' ) ? static::CACHE_PREFIX : get_called_class(),
+                       defined( 'static::CACHE_PREFIX' ) ? static::CACHE_PREFIX : static::class,
                        md5( $text ), $flags );
 
                $value = $cache->get( $key );
@@ -264,8 +266,8 @@ interface PPFrame {
 
        /**
         * Get an argument to this frame by name
-        * @param string $name
-        * @return bool
+        * @param int|string $name
+        * @return string|bool
         */
        public function getArgument( $name );