Merge "Fix flaky test BlockListPagerTest::testFormatValue"
[lhc/web/wiklou.git] / includes / EditPage.php
index 41238df..d8fef17 100644 (file)
@@ -869,7 +869,7 @@ class EditPage {
                } elseif ( $this->section == 'new' ) {
                        // Nothing *to* preview for new sections
                        return false;
-               } elseif ( ( $request->getVal( 'preload' ) !== null || $this->mTitle->exists() )
+               } elseif ( ( $request->getCheck( 'preload' ) || $this->mTitle->exists() )
                        && $this->context->getUser()->getOption( 'previewonfirst' )
                ) {
                        // Standard preference behavior
@@ -975,7 +975,7 @@ class EditPage {
 
                        $this->scrolltop = $request->getIntOrNull( 'wpScrolltop' );
 
-                       if ( $this->textbox1 === '' && $request->getVal( 'wpTextbox1' ) === null ) {
+                       if ( $this->textbox1 === '' && !$request->getCheck( 'wpTextbox1' ) ) {
                                // wpTextbox1 field is missing, possibly due to being "too big"
                                // according to some filter rules such as Suhosin's setting for
                                // suhosin.request.max_value_length (d'oh)
@@ -4557,7 +4557,10 @@ ERROR;
                        return $wgParser->guessLegacySectionNameFromWikiText( $text );
                }
                // Meanwhile, real browsers get real anchors
-               return $wgParser->guessSectionNameFromWikiText( $text );
+               $name = $wgParser->guessSectionNameFromWikiText( $text );
+               // With one little caveat: per T216029, fragments in HTTP redirects need to be urlencoded,
+               // otherwise Chrome double-escapes the rest of the URL.
+               return '#' . urlencode( mb_substr( $name, 1 ) );
        }
 
        /**