From 7d205e888a94f1a39efbb1ec8b55b1185a0db755 Mon Sep 17 00:00:00 2001 From: umherirrender Date: Sun, 29 Apr 2012 20:14:40 +0200 Subject: [PATCH] (bug 30975) API import of pages with invalid characters in this wiki leads to Fatal Error Change-Id: Ifc3ba51efe19bded51460749a1cb980a9c5244c7 --- RELEASE-NOTES-1.20 | 1 + includes/api/ApiImport.php | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES-1.20 b/RELEASE-NOTES-1.20 index bd8f775511..d35fa79ff3 100644 --- a/RELEASE-NOTES-1.20 +++ b/RELEASE-NOTES-1.20 @@ -101,6 +101,7 @@ production. * (bug 32492) API now allows editing using pageid * (bug 32497) API now allows changing of protection level using pageid * (bug 32498) API now allows comparing pages using pageids +* (bug 30975) API import of pages with invalid characters in this wiki leads to Fatal Error === Languages updated in 1.20 === diff --git a/includes/api/ApiImport.php b/includes/api/ApiImport.php index ade9f1f3fd..5093b6b63f 100644 --- a/includes/api/ApiImport.php +++ b/includes/api/ApiImport.php @@ -186,8 +186,16 @@ class ApiImportReporter extends ImportReporter { function reportPage( $title, $origTitle, $revisionCount, $successCount, $pageInfo ) { // Add a result entry $r = array(); - ApiQueryBase::addTitleInfo( $r, $title ); - $r['revisions'] = intval( $successCount ); + + if ( $title === null ) { + # Invalid or non-importable title + $r['title'] = $pageInfo['title']; + $r['invalid'] = ''; + } else { + ApiQueryBase::addTitleInfo( $r, $title ); + $r['revisions'] = intval( $successCount ); + } + $this->mResultArr[] = $r; // Piggyback on the parent to do the logging -- 2.20.1