r82304 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r82303‎ | r82304 | r82305 >
Date:22:03, 16 February 2011
Author:reedy
Status:ok (Comments)
Tags:
Comment:
Per hashar CR on r82169, might aswell santise at input level
Modified paths:
  • /trunk/extensions/CodeReview/backend/CodeRevision.php (modified) (history)
  • /trunk/extensions/CodeReview/ui/CodeRevisionView.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/backend/CodeRevision.php
@@ -834,7 +834,6 @@
835835 public function addReferencesFrom( $revs ) {
836836 $data = array();
837837 foreach ( array_unique( (array)$revs ) as $rev ) {
838 - $rev = intval( ltrim( $rev, 'r' ) );
839838 if ( $rev > $this->getId() ) {
840839 $data[] = array(
841840 'cf_repo_id' => $this->getRepoId(),
@@ -863,7 +862,6 @@
864863 public function addReferencesTo( $revs ) {
865864 $data = array();
866865 foreach ( array_unique( (array)$revs ) as $rev ) {
867 - $rev = intval( ltrim( $rev, 'r' ) );
868866 if ( $rev < $this->getId() ) {
869867 $data[] = array(
870868 'cf_repo_id' => $this->getRepoId(),
Index: trunk/extensions/CodeReview/ui/CodeRevisionView.php
@@ -52,13 +52,19 @@
5353 $this->mStrikeSignoffs = $wgRequest->getCheck( 'wpStrikeSignoffs' ) ?
5454 $this->mSelectedSignoffs : array();
5555
56 - $this->mAddReference = $wgRequest->getCheck( 'wpAddReferenceSubmit' ) ?
57 - $wgRequest->getArray( 'wpAddReference', array() ) : array();
 56+ $this->mAddReference = $wgRequest->getCheck( 'wpAddReferenceSubmit' )
 57+ ? array_map( array( $this, 'ltrimIntval' ), $wgRequest->getArray( 'wpAddReference', array() ) )
 58+ : array();
5859
5960 $this->mRemoveReferences = $wgRequest->getCheck( 'wpRemoveReferences' ) ?
6061 $wgRequest->getIntArray( 'wpReferences', array() ) : array();
6162 }
6263
 64+ private function ltrimIntval( $item ) {
 65+ $item = ltrim( $item, 'r' );
 66+ return intval( $item );
 67+ }
 68+
6369 function execute() {
6470 global $wgOut, $wgLang;
6571 if ( !$this->mRepo ) {

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r82169* (bug 27400) Manual revision association won't accept "rXXXXX"...reedy15:00, 15 February 2011

Comments

#Comment by Hashar (talk | contribs)   06:48, 17 February 2011

This way we only have one injection point and it is properly filtered :p

Status & tagging log