Last modified: 2011-03-09 22:28:55 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 T29960, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 27960 - $.escapeRE shouldn't escape all uppercase and numbers
$.escapeRE shouldn't escape all uppercase and numbers
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
JavaScript (Other open bugs)
1.17.x
All All
: Normal enhancement (vote)
: ---
Assigned To: Krinkle
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-03-09 16:46 UTC by Helder
Modified: 2011-03-09 22:28 UTC (History)
3 users (show)

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


Attachments

Description Helder 2011-03-09 16:46:32 UTC
Currently

$.escapeRE('ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890')

is returning

'\A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z\1\2\3\4\5\6\7\8\9\0'

but it should not escape any letters.

I think it is necessary to escape the '-' in the regex:

/([\\{}()|.?*+-\^$\[\]])/g

because it is probably being understood as the interval from '+' to '\'.
Comment 1 Bergi 2011-03-09 17:08:52 UTC
Another possibility would be to push the - to the end of the expression:

/([\\{}()|.?*+^$[\]-])/g
Comment 2 Krinkle 2011-03-09 21:15:30 UTC
It only escapes capitals though, not lowercase characters.

The javascript test suite contains lower case characters to make sure normal characters aren't escaped. I'll fix this asap and update the tests to include all a-z A-Z and 0-9 for false positives.
Comment 3 Krinkle 2011-03-09 21:50:14 UTC
Was a regression because of r83284 (which fixed bug 27848).

Fixed in r83610, also added tests to easily catch these regressions in the future before they're committed.
Comment 4 Krinkle 2011-03-09 22:28:55 UTC
Check the test suite on a a wiki running trunk:

TranslateWiki.net for example
http://translatewiki.net/wiki/Special:BlankPage?action=mwutiltest&debug=true

(second heading "Prototype functions added by MediaWiki")

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


Navigation
Links