From: Adam Roses Wight Date: Wed, 21 May 2014 08:04:04 +0000 (-0700) Subject: Correct field used to detect incomplete POST X-Git-Tag: 1.31.0-rc.0~15486^2~1 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/comptes/journal.php?a=commitdiff_plain;h=262a7e2d581c1b13c90247643fa1633cd33b0988;p=lhc%2Fweb%2Fwiklou.git Correct field used to detect incomplete POST We were using something other than the last parameter to check for an incomplete request. That is not guaranteed to work. TODO: * Is it worthwhile to take a checksum of the params as well? Change-Id: I78f1bbcc9bb092568fbfbec19c08d697c9ae75f8 --- diff --git a/includes/EditPage.php b/includes/EditPage.php index ca11f16964..b1a7a33f62 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -797,9 +797,9 @@ class EditPage { // suhosin.request.max_value_length (d'oh) $this->incompleteForm = true; } else { - // edittime should be one of our last fields; if it's missing, - // the submission probably broke somewhere in the middle. - $this->incompleteForm = is_null( $this->edittime ); + // If we receive the last parameter of the request, we can fairly + // claim the POST request has not been truncated. + $this->incompleteForm = !$request->getVal( 'wpUltimateParam' ); } if ( $this->incompleteForm ) { # If the form is incomplete, force to preview. @@ -2584,6 +2584,9 @@ class EditPage { } } + // Marker for detecting truncated form data. This must be the last + // parameter sent in order to be of use, so do not move me. + $wgOut->addHTML( Html::hidden( 'wpUltimateParam', true ) ); $wgOut->addHTML( $this->editFormTextBottom . "\n\n" ); if ( !$wgUser->getOption( 'previewontop' ) ) {