Page MenuHomePhabricator

[Regression] MWException when saving section=new on .css and .js pages
Closed, ResolvedPublic

Description

To reproduce:

  1. Open a css page for editing with section=new, e.g. http://en.wikipedia.org/wiki/Special:MyPage/common.css?action=edit&section=new
  2. Enter text.
  3. Click "Save page".

Ideally the initial action=edit&section=new should present an error message. At the least, the attempted save should present an error message instead of throwing an uncaught exception.

Exception:

2012-12-12 14:11:05 mw55 enwiki: [3e244cf2] /w/index.php?title=User:Anomie/common.css&action=submit Exception from line 1466 of /usr/local/apache/common-local/php-1.21wmf5/includes/WikiPage.php: sections not supported for content model css
#0 [internal function]: WikiPage->replaceSectionContent('new', Object(CssContent), 'test')
#1 /usr/local/apache/common-local/php-1.21wmf5/includes/Article.php(1944): call_user_func_array(Array, Array)
#2 /usr/local/apache/common-local/php-1.21wmf5/includes/EditPage.php(1486): Article->__call('replaceSectionC...', Array)
#3 /usr/local/apache/common-local/php-1.21wmf5/includes/EditPage.php(1486): Article->replaceSectionContent('new', Object(CssContent), 'test')
#4 /usr/local/apache/common-local/php-1.21wmf5/includes/EditPage.php(1133): EditPage->internalAttemptSave(false, false)
#5 /usr/local/apache/common-local/php-1.21wmf5/includes/EditPage.php(396): EditPage->attemptSave()
#6 /usr/local/apache/common-local/php-1.21wmf5/includes/actions/EditAction.php(51): EditPage->edit()
#7 /usr/local/apache/common-local/php-1.21wmf5/includes/actions/EditAction.php(71): EditAction->show()
#8 /usr/local/apache/common-local/php-1.21wmf5/includes/Wiki.php(429): SubmitAction->show()
#9 /usr/local/apache/common-local/php-1.21wmf5/includes/Wiki.php(305): MediaWiki->performAction(Object(Article), Object(Title))
#10 /usr/local/apache/common-local/php-1.21wmf5/includes/Wiki.php(555): MediaWiki->performRequest()
#11 /usr/local/apache/common-local/php-1.21wmf5/includes/Wiki.php(448): MediaWiki->main()
#12 /usr/local/apache/common-local/php-1.21wmf5/index.php(59): MediaWiki->run()
#13 /usr/local/apache/common-local/live-1.5/index.php(3): require('/usr/local/apac...')
#14 {main}


Version: 1.21.x
Severity: normal
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=50962

Details

Reference
bz43008

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 1:07 AM
bzimport set Reference to bz43008.
bzimport added a subscriber: Unknown Object (MLST).

Adding sections to JS/CSS pages doesn't make sense and will not be supported.
But there should be no fatal error, this should be handled more nicely.

(In reply to comment #2)

But there should be no fatal error, this should be handled more nicely.

Exactly.

Change I3d2901b7: (bug 43008) show error page if sections not supporte.

  • Bug 43784 has been marked as a duplicate of this bug. ***

for the reasons mentioned in Bug 43784, it makes sense for me.

This should no longer be an *internal* error, but a "normal" user level error. Which it currently is, as far as I can see.

I maintain that adding sections to JavaScript makes no sense and is misleading. Section support needs more than just adding sections, it also needs a way to split a text by section, etc. This would horribly break JS.

The use case described by bug 43784 is a nasty hack, if you want a nice interface for appending to page text, file a feature request for that.

I'll not close this now, so to not start an edit war. I suggest however to again close this as fixed, especially since the original problem, the fatal error, is gone. What is left is a request to restore the ability to somehow append to JavaScript. That should be a separate bug.

(In reply to comment #8)

I'll not close this now, so to not start an edit war. I suggest however to
again close this as fixed, especially since the original problem, the fatal
error, is gone. What is left is a request to restore the ability to somehow
append to JavaScript. That should be a separate bug.

I'll close it again. For the reasons above, if you want an interface to append arbitrary text to any page, even pages that don't support sections, open a new bug.