Last modified: 2008-12-10 14:13:12 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 16581 - API edit "section" parameter really bad handled
API edit "section" parameter really bad handled
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
1.14.x
All All
: Normal blocker (vote)
: ---
Assigned To: Roan Kattouw
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-12-07 14:44 UTC by Kelson [Emmanuel Engelhart]
Modified: 2008-12-10 14:13 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Kelson [Emmanuel Engelhart] 2008-12-07 14:44:03 UTC
It seems that a new bug was recently introduced to the trunk.

What to do:
* Edit any article with many sections an try to rewrite completely the article (no "section" parameter)

What you get:
* Your new content replaces only the introduction (section=0)

What you want:
* Your new content replacing the whole page

Remarks:
* The live version (r43634) does not have the bug, but the head does has the problem.
* Adding $params['section'] = ''; line 120 of ApiEditPage.php avoids the problem.
* The problem does not concern the user interface... only the API.
* I think that something was changed in EditPage.php with the form field handling and that impacts the API.
Comment 1 P.Copp 2008-12-07 20:24:15 UTC
Tracked it down to r44015 (Article.php):
> ...
> +	function replaceSection( $section, $text, $summary = '', $edittime = NULL ) {
>  		wfProfileIn( __METHOD__ );
> -
> -		if( $section == '' ) {
> -			// Whole-page edit; let the text through unmolested.
> +		if( $section === '' ) {
> +			// Whole-page edit; let the whole text through
> ...


If you edit through the API, $section is null here, so the identity operator won't work here.

I'd suggest to just use ..if(!$section) .. or would that be bad style?
Comment 2 P.Copp 2008-12-10 03:53:22 UTC
On second thought, (!$section) of course wouldn't work, as '0' is false, too. So probably just change it back to ($section == '').

I'm marking this bug as blocker for now, as it really should be fixed before the next scap, or else the bots out there would create a giant mess on all projects within minutes.
Comment 3 Roan Kattouw 2008-12-10 13:40:58 UTC
(In reply to comment #2)
> On second thought, (!$section) of course wouldn't work, as '0' is false, too.
> So probably just change it back to ($section == '').
> 
> I'm marking this bug as blocker for now, as it really should be fixed before
> the next scap, or else the bots out there would create a giant mess on all
> projects within minutes.
> 

Good idea. I'll tell Brion about this to make sure he doesn't accidentally scap this. I'd fix it earlier, but I'm kind of busy this week and I haven't looked into the possible side effects of changing === '' back to == ''.
Comment 4 Roan Kattouw 2008-12-10 14:13:12 UTC
(In reply to comment #3)
> and I haven't looked
> into the possible side effects of changing === '' back to == ''.
> 

Turns out I didn't need to, passing '' instead of null was good enough. Fixed in r44394.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links