MaxSem has submitted this change and it was merged. Change subject: Don't quote assert expressions in DairikiDiff ......................................................................
Don't quote assert expressions in DairikiDiff Per HHVM issue 5128, it is not possible to use '$this' in string-literal assert() expressions. We can either wait for this to be fixed (unlikely to happen soon, since it involves deep interpreter internals), comment out or remove the asserts, or simply unquote them, so that they are actual expressions rather than strings. The downside to this is that assertions will always be evaluated (but so what, they are extremely cheap), and that when an assertion fail the error message will simply read 'assert(): Assertion failed in /path/to/file on line XXX' as opposed to including the expression in the output. Fair trade, IMO. See: https://github.com/facebook/hhvm/issues/5128 Bug: T124163 Change-Id: Ib458b1b0c28f8d38e9df427196ae79814f6dc0c2 (cherry picked from commit 9e867b07b8cc42370c358fc0b25679920ceb8e62) --- M RELEASE-NOTES-1.26 M includes/diff/DairikiDiff.php 2 files changed, 23 insertions(+), 16 deletions(-) Approvals: MaxSem: Looks good to me, approved jenkins-bot: Verified diff --git a/RELEASE-NOTES-1.26 b/RELEASE-NOTES-1.26 index fd2e5e6..13826b8 100644 --- a/RELEASE-NOTES-1.26 +++ b/RELEASE-NOTES-1.26 @@ -1,6 +1,13 @@ Security reminder: If you have PHP's register_globals option set, you must turn it off. MediaWiki will not work with it enabled. +== MediaWiki 1.26.4 == + +This is a maintenance release of the MediaWiki 1.26 branch. + +=== Changes since 1.26.3 === +* (T124163) Fixed fatal error in DifferenceEngine under HHVM. + == MediaWiki 1.26.3 == This is a maintenance release of the MediaWiki 1.26 branch. diff --git a/includes/diff/DairikiDiff.php b/includes/diff/DairikiDiff.php index 7bdc654..ef75a7a 100644 --- a/includes/diff/DairikiDiff.php +++ b/includes/diff/DairikiDiff.php @@ -237,8 +237,8 @@ $edits = array(); $xi = $yi = 0; while ( $xi < $n_from || $yi < $n_to ) { - assert( '$yi < $n_to || $this->xchanged[$xi]' ); - assert( '$xi < $n_from || $this->ychanged[$yi]' ); + assert( $yi < $n_to || $this->xchanged[$xi] ); + assert( $xi < $n_from || $this->ychanged[$yi] ); // Skip matching "snake". $copy = array(); @@ -434,7 +434,7 @@ while ( list( , $y ) = each( $matches ) ) { if ( empty( $this->in_seq[$y] ) ) { $k = $this->lcsPos( $y ); - assert( '$k > 0' ); + assert( $k > 0 ); $ymids[$k] = $ymids[$k - 1]; break; } @@ -442,7 +442,7 @@ while ( list( , $y ) = each( $matches ) ) { if ( $y > $this->seq[$k - 1] ) { - assert( '$y < $this->seq[$k]' ); + assert( $y < $this->seq[$k] ); // Optimization: this is a common case: // next match is just replacing previous match. $this->in_seq[$this->seq[$k]] = false; @@ -450,7 +450,7 @@ $this->in_seq[$y] = 1; } elseif ( empty( $this->in_seq[$y] ) ) { $k = $this->lcsPos( $y ); - assert( '$k > 0' ); + assert( $k > 0 ); $ymids[$k] = $ymids[$k - 1]; } } @@ -493,7 +493,7 @@ } } - assert( '$ypos != $this->seq[$end]' ); + assert( $ypos != $this->seq[$end] ); $this->in_seq[$this->seq[$end]] = false; $this->seq[$end] = $ypos; @@ -581,7 +581,7 @@ $i = 0; $j = 0; - assert( 'count($lines) == count($changed)' ); + assert( count( $lines ) == count( $changed ) ); $len = count( $lines ); $other_len = count( $other_changed ); @@ -602,7 +602,7 @@ } while ( $i < $len && !$changed[$i] ) { - assert( '$j < $other_len && ! $other_changed[$j]' ); + assert( $j < $other_len && ! $other_changed[$j] ); $i++; $j++; while ( $j < $other_len && $other_changed[$j] ) { @@ -639,11 +639,11 @@ while ( $start > 0 && $changed[$start - 1] ) { $start--; } - assert( '$j > 0' ); + assert( $j > 0 ); while ( $other_changed[--$j] ) { continue; } - assert( '$j >= 0 && !$other_changed[$j]' ); + assert( $j >= 0 && !$other_changed[$j] ); } /* @@ -667,7 +667,7 @@ $i++; } - assert( '$j < $other_len && ! $other_changed[$j]' ); + assert( $j < $other_len && ! $other_changed[$j] ); $j++; if ( $j < $other_len && $other_changed[$j] ) { $corresponding = $i; @@ -685,11 +685,11 @@ while ( $corresponding < $i ) { $changed[--$start] = 1; $changed[--$i] = 0; - assert( '$j > 0' ); + assert( $j > 0 ); while ( $other_changed[--$j] ) { continue; } - assert( '$j >= 0 && !$other_changed[$j]' ); + assert( $j >= 0 && !$other_changed[$j] ); } } } @@ -853,8 +853,8 @@ public function __construct( $from_lines, $to_lines, $mapped_from_lines, $mapped_to_lines ) { - assert( 'count( $from_lines ) == count( $mapped_from_lines )' ); - assert( 'count( $to_lines ) == count( $mapped_to_lines )' ); + assert( count( $from_lines ) == count( $mapped_from_lines ) ); + assert( count( $to_lines ) == count( $mapped_to_lines ) ); parent::__construct( $mapped_from_lines, $mapped_to_lines ); @@ -945,7 +945,7 @@ $this->flushLine( $tag ); $word = substr( $word, 1 ); } - assert( '!strstr( $word, "\n" )' ); + assert( !strstr( $word, "\n" ) ); $this->group .= $word; } } -- To view, visit https://gerrit.wikimedia.org/r/294681 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ib458b1b0c28f8d38e9df427196ae79814f6dc0c2 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/core Gerrit-Branch: REL1_26 Gerrit-Owner: Lewis Cawte <le...@lewiscawte.me> Gerrit-Reviewer: Lewis Cawte <le...@lewiscawte.me> Gerrit-Reviewer: MaxSem <maxsem.w...@gmail.com> Gerrit-Reviewer: Ori.livneh <o...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits