Page MenuHomePhabricator

Parser->serialiseHalfParsedText($text) does not save strip items if $text begins with a strip marker
Open, MediumPublic

Description

Author: foxlit.mwzilla

Description:
The serialiseHalfParsedText method in the Parser class attempts to store all strip markers, links, etc needed to render a bit of wikitext. It finds the strip markers in the provided text using a while loop; in 1.16.0, this is in includes/parser/Parser.php, line 5087:
while( ( $start_pos = strpos( $text, $this->mUniqPrefix, $pos ) ) && ( $end_pos = strpos( $text, self::MARKER_SUFFIX, $pos ) ) )

If $text begins with a strip marker, $start_pos will be assigned 0; which causes the while condition to be false; so serialiseHalfParsedText will not store any strip markers at all; checking whether the strpos return is identical to FALSE would fix this.

While I'm running into this issue on 1.16.0, the same while loop exists in SVN revision 80248.


Version: 1.16.x
Severity: minor

Details

Reference
bz26731