Index: branches/wmf/1.17wmf1/includes/api/ApiPageSet.php |
— | — | @@ -446,6 +446,10 @@ |
447 | 447 | } |
448 | 448 | |
449 | 449 | $pageids = array_map( 'intval', $pageids ); // paranoia |
| 450 | + $remaining = array_flip( $pageids ); |
| 451 | + |
| 452 | + $pageids = self::getPositiveIntegers( $pageids ); |
| 453 | + |
450 | 454 | $set = array( |
451 | 455 | 'page_id' => $pageids |
452 | 456 | ); |
— | — | @@ -457,7 +461,6 @@ |
458 | 462 | __METHOD__ ); |
459 | 463 | $this->profileDBOut(); |
460 | 464 | |
461 | | - $remaining = array_flip( $pageids ); |
462 | 465 | $this->initFromQueryResult( $db, $res, $remaining, false ); // process PageIDs |
463 | 466 | |
464 | 467 | // Resolve any found redirects |
— | — | @@ -535,6 +538,8 @@ |
536 | 539 | $pageids = array(); |
537 | 540 | $remaining = array_flip( $revids ); |
538 | 541 | |
| 542 | + $revids = self::getPositiveIntegers( $revids ); |
| 543 | + |
539 | 544 | $tables = array( 'revision', 'page' ); |
540 | 545 | $fields = array( 'rev_id', 'rev_page' ); |
541 | 546 | $where = array( 'rev_id' => $revids, 'rev_page = page_id' ); |
— | — | @@ -712,6 +717,25 @@ |
713 | 718 | return $linkBatch; |
714 | 719 | } |
715 | 720 | |
| 721 | + /** |
| 722 | + * Returns the input array of integers with all values < 0 removed |
| 723 | + * |
| 724 | + * @param $array array |
| 725 | + * @return array |
| 726 | + */ |
| 727 | + private static function getPositiveIntegers( $array ) { |
| 728 | + // bug 25734 API: possible issue with revids validation |
| 729 | + // It seems with a load of revision rows, MySQL gets upset |
| 730 | + // Remove any < 0 integers, as they can't be valid |
| 731 | + foreach( $array as $i => $int ) { |
| 732 | + if ( $int < 0 ) { |
| 733 | + unset( $array[$i] ); |
| 734 | + } |
| 735 | + } |
| 736 | + |
| 737 | + return $array; |
| 738 | + } |
| 739 | + |
716 | 740 | protected function getAllowedParams() { |
717 | 741 | return array( |
718 | 742 | 'titles' => array( |
Property changes on: branches/wmf/1.17wmf1/includes/api |
___________________________________________________________________ |
Modified: svn:mergeinfo |
719 | 743 | Merged /trunk/phase3/includes/api:r89512-89513 |
Property changes on: branches/wmf/1.17wmf1/includes |
___________________________________________________________________ |
Modified: svn:mergeinfo |
720 | 744 | Merged /trunk/phase3/includes:r89512-89513 |