Index: trunk/phase3/includes/parser/Parser.php |
— | — | @@ -2793,8 +2793,7 @@ |
2794 | 2794 | |
2795 | 2795 | # Possibilities for substMatch: "subst", "safesubst" or FALSE |
2796 | 2796 | # Decide whether to expand template or keep wikitext as-is. |
2797 | | - if ( $this->ot['wiki'] ) |
2798 | | - { |
| 2797 | + if ( $this->ot['wiki'] ) { |
2799 | 2798 | if ( $substMatch === false ) { |
2800 | 2799 | $literal = true; # literal when in PST with no prefix |
2801 | 2800 | } else { |
Index: trunk/phase3/includes/MagicWord.php |
— | — | @@ -719,11 +719,14 @@ |
720 | 720 | if ( $regex === '' ) { |
721 | 721 | continue; |
722 | 722 | } |
723 | | - preg_match( $regex, $text, $match ); |
724 | | - if ( $match ) { |
725 | | - list( $found, $param ) = $this->parseMatch( $match ); |
726 | | - $text = substr( $text, strlen( $found ) + 1 ); |
727 | | - return $found; |
| 723 | + if ( preg_match( $regex, $text, $m ) ) { |
| 724 | + list( $id, $param ) = $this->parseMatch( $m ); |
| 725 | + if ( strlen( $m[0] ) >= strlen( $text ) ) { |
| 726 | + $text = ''; |
| 727 | + } else { |
| 728 | + $text = substr( $text, strlen( $m[0] ) ); |
| 729 | + } |
| 730 | + return $id; |
728 | 731 | } |
729 | 732 | } |
730 | 733 | return false; |