From: Sam Reed Date: Sat, 19 Mar 2011 23:23:32 +0000 (+0000) Subject: * (Bug 14005) editing section 0 of an existing but empty page gives no such section... X-Git-Tag: 1.31.0-rc.0~31309 X-Git-Url: https://git.cyclocoop.org/admin/?a=commitdiff_plain;h=4569f31e097a8ee186bfa21ede1f734f52d9edb6;p=lhc%2Fweb%2Fwiklou.git * (Bug 14005) editing section 0 of an existing but empty page gives no such section error Tested, with minor tweak. Also removed now un-needed code Patch by Harry Burt --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 815c84e4f2..aecd3bd494 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -197,6 +197,8 @@ PHP if you have not done so prior to upgrading MediaWiki. * (bug 28034) uploading file to local wiki when file exists on shared repository (commons) gives spurious info in the warning message * Usernames get lost when selecting different sorts on Special:listfiles +* (Bug 14005) editing section 0 of an existing but empty page gives no such + section error === API changes in 1.18 === * (bug 26339) Throw warning when truncating an overlarge API result diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 81402e9ca7..48e83d2306 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -4943,8 +4943,10 @@ class Parser { # Find the target section if ( $sectionIndex == 0 ) { - # Section zero doesn't nest, level=big - $targetLevel = 1000; + if ( !$node ) { + # The page definitely exists - we checked that earlier - so it must be blank: see bug #14005 + return $text; + } } else { while ( $node ) { if ( $node->getName() === 'h' ) {