Index: trunk/phase3/includes/Parser.php |
— | — | @@ -1991,7 +1991,8 @@ |
1992 | 1992 | return false; |
1993 | 1993 | } |
1994 | 1994 | |
1995 | | - if( strpos( $str, '<' ) === false ) { |
| 1995 | + $lt = strpos( $str, '<' ); |
| 1996 | + if( $lt === false || $lt > $pos ) { |
1996 | 1997 | // Easy; no tag nesting to worry about |
1997 | 1998 | $before = substr( $str, 0, $pos ); |
1998 | 1999 | $after = substr( $str, $pos+1 ); |
— | — | @@ -2025,7 +2026,31 @@ |
2026 | 2027 | // Embedded in a tag; don't break it. |
2027 | 2028 | break; |
2028 | 2029 | default: |
2029 | | - // ignore |
| 2030 | + // Skip ahead looking for something interesting |
| 2031 | + $colon = strpos( $str, ':', $i ); |
| 2032 | + if( $colon === false ) { |
| 2033 | + // Nothing else interesting |
| 2034 | + wfProfileOut( $fname ); |
| 2035 | + return false; |
| 2036 | + } |
| 2037 | + $lt = strpos( $str, '<', $i ); |
| 2038 | + if( $stack === 0 ) { |
| 2039 | + if( $lt === false || $colon < $lt ) { |
| 2040 | + // We found it! |
| 2041 | + $before = substr( $str, 0, $colon ); |
| 2042 | + $after = substr( $str, $colon + 1 ); |
| 2043 | + wfProfileOut( $fname ); |
| 2044 | + return $i; |
| 2045 | + } |
| 2046 | + } |
| 2047 | + if( $lt === false ) { |
| 2048 | + // Nothing else interesting to find; abort! |
| 2049 | + // We're nested, but there's no close tags left. Abort! |
| 2050 | + break 2; |
| 2051 | + } |
| 2052 | + // Skip ahead to next tag start |
| 2053 | + $i = $lt; |
| 2054 | + $state = MW_COLON_STATE_TAGSTART; |
2030 | 2055 | } |
2031 | 2056 | break; |
2032 | 2057 | case 1: // MW_COLON_STATE_TAG: |