Last modified: 2014-11-20 15:00:42 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T40170, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 38170 - [ReplaceText] Incorrect error: You must select at least one namespace.
[ReplaceText] Incorrect error: You must select at least one namespace.
Status: NEW
Product: MediaWiki extensions
Classification: Unclassified
ReplaceText (Other open bugs)
REL1_19-branch
PC Linux
: High critical with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
http://www.issuepedia.org/Special:Rep...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-07-04 21:15 UTC by badon
Modified: 2014-11-20 15:00 UTC (History)
7 users (show)

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


Attachments
Screenshot of the error (200.85 KB, image/jpeg)
2012-07-04 21:15 UTC, badon
Details
modifications to deal with form-size bug (21.87 KB, text/php)
2012-12-29 15:12 UTC, Woozle
Details
A patch for Woozle's edits with minor edits by badon (8.97 KB, patch)
2013-01-22 22:52 UTC, badon
Details
The patched file, for Replace Text users that need a fix immediately (22.06 KB, application/octet-stream)
2013-01-22 22:54 UTC, badon
Details

Description badon 2012-07-04 21:15:45 UTC
Created attachment 10823 [details]
Screenshot of the error

ReplaceText 0.9.3 incorrectly gives the error "You must select at least one namespace." when the Main namespace is select. This error appeared suddenly after using ReplaceText successfully since it was released in January 2012, even on large numbers of pages. 

However, there are about 1500 pages to replace text on for the search in the screenshot, and inverting the selection and then selecting only one of them causes the bug to resolve itself. So, it seems the bug is related to the number of pages to be replaced.
Comment 1 Woozle 2012-08-03 02:39:34 UTC
I'm having this same problem, but also the "Invert selections" button isn't working for me so I can't easily confirm that the not-really-a-workaround works (hundreds of checkboxes to toggle manually).
Comment 2 Yaron Koren 2012-08-03 03:05:12 UTC
Woozle - my guess is that there's some unrelated Javascript problem that's causing "invert selection" to not work - and maybe the other issue as well. I would recommend looking in the Javascript console in either Chrome or Firefox to see if any error messages appear.
Comment 3 Jerry Pank 2012-08-10 16:54:45 UTC
Have the same problem - no solution but maybe a few pointers:

MediaWiki	1.18.1
PHP	5.3.3 (apache2handler)
MySQL	5.1.61
Replace Text (Version 0.9.1)

Other installed extensions here: http://www.cookipedia.co.uk/recipes_wiki/Special:Version

Replace text was working - now fails with You must select at least one
namespaceerror on a huge replace (2000 pages)

The namespace checkbox info is not being passed by Javascript hence unchecked ns error.

This is the javascript error generated 

Timestamp: 10/08/2012 17:29:40
Error: ReferenceError: mwToggleSearchCheckboxes is not defined
Source File: http://www.cookipedia.co.uk/recipes_wiki/Special:ReplaceText

From the system error log I see:

[Fri Aug 10 17:29:38 2012] [error] [client nnn.nnn.nnn.nnn] File does not exist: /home/httpd/vhosts/cookipedia.co.uk/httpdocs/wiki/skins/common/search.js, referer: http://www.cookipedia.co.uk/recipes_wiki/Special:ReplaceText

>probably called from line 330 SpecialReplaceText.php : 

                // add javascript specific to special:search
                $wgOut->addScriptFile( 'search.js' );

No search.js anywhere in my wiki dir tree
No search.js in a fresh test install of the mw repo
No search.js in the ReplaceText repo

I'm not sure where to look now?
Comment 4 antony.seedhouse 2012-08-30 13:48:57 UTC
http://php.net/manual/en/info.configuration.php

max_input_vars 	1000 	PHP_INI_PERDIR 	Available since PHP 5.3.9.

Increase to something much higher

Also, if your PHP has suhosin, 

suhosin.post.max_vars
suhosin.request.max_vars
Comment 5 Jerry Pank 2012-08-30 15:17:05 UTC
Hi Anthony

Thanks for your input.

From the ReplaceText page, before even running a search, if I click the 'Check: All' button, I immediately get a fatal Javascript error:

Timestamp: 30/08/2012 16:13:53
Error: ReferenceError: mwToggleSearchCheckboxes is not defined
Source File: http://www.cookipedia.co.uk/recipes_wiki/Special:ReplaceText
Line: 1

I can't see how changing the above php config var would have an effect upon Javascript. Perhaps you can enlighten me?
Comment 6 antony.seedhouse 2012-08-30 15:27:18 UTC
Hi, sorry, my solution is for the main bug.

When checking my firefox web console I also get the ReferenceError when clicking the check all/none buttons, but they still work and nothing stops me using the page.

Have you tried in another browser and/or with all browser plugins/addons disabled?
Comment 7 Yaron Koren 2012-08-30 16:57:41 UTC
Antony - thanks for that discovery! I bet that was the issue.

Jerry - I think your bug is totally unrelated. Actually, I think that issue is one that was fixed in the most recent version of Replace Text, 0.9.3.
Comment 8 Yaron Koren 2012-08-31 17:39:31 UTC
Thanks to everyone for their contributions. I'm marking this bug as "invalid", since it didn't require any code changes. I added more info about the problem to the Replace Text extension page.
Comment 9 badon 2012-12-27 21:41:12 UTC
I changed the status of this to "WONTFIX", since the report was for an incorrect error message that is still incorrect. This could be resolved as "FIXED" if ReplaceText at least detected when large numbers of pages were being returned, and it could give a different error message that explains what is likely actually occurring with a server limitation. Then, the user could be directed to use the feature enhancement I proposed here:

https://bugzilla.wikimedia.org/show_bug.cgi?id=43472
Comment 10 badon 2012-12-29 05:56:27 UTC
It looks like the default value for max_input_vars is 1000, so ReplaceText could detect when there are more than 1000 search results, and automatically use that as a default limit value, and then deliver a different error message that prompts the user to proceed with that limit, or enter another limit and run the search again.

It appears that the max_input_vars parameter in PHP exists for the purpose of reducing the effectiveness of some types of DoS attacks. As such, this bug report and bug 43472 are relevant for security, so leaving a user with only a workaround that requires access to the server configuration AND compromising security, should be discouraged.

So, I'm elevating both bug reports to "critical" severity. I decided against "major" severity because the known issues section on the extension page:

https://www.mediawiki.org/wiki/Extension:Replace_Text#Known_issues

mentions the possibility that some replacements may not actually be done, which constitutes a loss of data that may or may not be recoverable after a partial replace has been done.
Comment 11 Woozle 2012-12-29 15:12:13 UTC
Created attachment 11566 [details]
modifications to deal with form-size bug

Attached is a modified version of the SpecialReplaceText.php file which deals with the form-size limitation (allows user to limit how many results to display). I also added a couple of code comments as I figured out how things worked.

The modification was done on 12/1, so there may have been additional changes to the main file since then.
Comment 12 Andre Klapper 2012-12-30 13:27:20 UTC
[This bug report is resolved/closed as WONTFIX, hence adding further comments or even attachments doesn't make much sense without changing the status again.]
Comment 13 badon 2012-12-30 18:09:51 UTC
I think we're trying to make the case that the status should be changed to FIXED, if you know what I mean.
Comment 14 badon 2013-01-22 22:52:00 UTC
Created attachment 11669 [details]
A patch for Woozle's edits with minor edits by badon

I tested Woozle's modification, and they work with Replace Text 0.9.6, but there are some smaller problems. 

The descriptive text was confusing, so I clarified it a little. I also found that using the exact value reported for max_input_vars did not work. In my test case, max_input_vars was 1000, but I had to reduce the maximum to 995 to get it work. The new descriptive text addresses that possibility.

Even though the limit is approximately 1000, the search results are not also limited. That means if there are millions of search results, the entire result set must be downloaded before the replace operation can proceed. So, Woozle's fix solves part of the problem, but Replace Text is still practically unusable on very large wikis.

Woozle's solution is a good starting place for working around the limitations of Replace Text, so I produced a patch for it with my edits. I will also upload the actual file. That should be sufficient for most people to resume using it until a more polished fix can be implemented.
Comment 15 badon 2013-01-22 22:54:16 UTC
Created attachment 11670 [details]
The patched file, for Replace Text users that need a fix immediately

Wiki admins can use this file instead of the patch, as a matter of convenience to resume using ReplaceText immediately.
Comment 16 Mark A. Hershberger 2014-08-17 20:07:59 UTC
I've run into this exact problem running the latest from gerrit + a 1.19 MediaWiki.

The problem is that edit_pages, move_pages and selected namespaces aren't passed in the pageListForm() method.

About to submit a patch to fix this.
Comment 17 Gerrit Notification Bot 2014-08-17 20:18:47 UTC
Change 154523 had a related patch set uploaded by MarkAHershberger:
Fix “Incorrect error: You must select at least one namespace.”

https://gerrit.wikimedia.org/r/154523
Comment 18 Gerrit Notification Bot 2014-08-18 14:50:43 UTC
Change 154523 merged by jenkins-bot:
Fix “Incorrect error: You must select at least one namespace.”

https://gerrit.wikimedia.org/r/154523
Comment 19 Kunal Mehta (Legoktm) 2014-08-20 19:47:16 UTC
Is a backport planned for this? If not, the target milestone should be adjusted.
Comment 20 Yaron Koren 2014-08-21 00:39:00 UTC
Good point - I just removed the "target milestone"; I don't know why it was set in the first place.
Comment 21 [[kgh]] 2014-11-08 17:15:02 UTC
(In reply to Gerrit Notification Bot from comment #18)
> Change 154523 merged by jenkins-bot:
> Fix “Incorrect error: You must select at least one namespace.”
> 
> https://gerrit.wikimedia.org/r/154523

May this bug be considered fix in conjunction with change [1]? If yes it might also by time to do a new release since a couple of other fixes were done in the meantime.

[1] https://git.wikimedia.org/commit/mediawiki%2Fextensions%2FReplaceText.git/eb819cd4b07e70fbadfe2334d55205e5c9aaa959
Comment 22 Andre Klapper 2014-11-20 15:00:42 UTC
All patches mentioned in this report were merged or abandoned - I'm resetting the ticket status.

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


Navigation
Links