Closed Bug 309840 Opened 19 years ago Closed 19 years ago

Regular expression /[/]/ gives "unterminated character class" error


(Core :: JavaScript Engine, defect)

Not set





(Reporter: jruderman, Assigned: mrbkap)




(Keywords: verified1.8)


(1 file)

Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8b5) Gecko/20050923

Firefox gives an "unterminated character class" error on the regular expression
/[/]/.  Safari and Opera 8.5 accept it.

I noticed this because a regular expression containing [/] appears in, which was mentioned in 
bug 309695 comment 9.

This is technically invalid. <>. I
have some raw data on top sites I can mine for how common this is in the wild.
OS: MacOS X → All
Hardware: Macintosh → All
Version: 1.8 Branch → Trunk
This is entirely contrary to ECMA-262 Edition 3, and to its regexp progenitor,
Perl.  However, mrbkap expressed sympathy, however fleeting under my withering
counterattack ;-). He wins this no-prize.

I'm quite interested in bclary's top site spidering results.

Assignee: general → mrbkap
I've been running scans of the top 69 sites 1 level deep (usually ~100 pages per
site) and haven't seen an instance of this error. This doesn't imply that the
error is rare. It has been a reoccuring issue over the years, especially on MS
sites. I could run a 2 level scan if you think it would be worth it, but it
would take a few days.
I think if we want this, we want it for Firefox 1.5.
Flags: blocking1.8b5?
Whiteboard: DUPEME
I searched for bugs with comments containing "unterminated character class" and
found these:

Open tech evang bugs: bug 235508, bug 224988 (Microsoft), bug 212822

Bugs with discussion: bug 89586, bug 173067, bug 212822
Need a fix this week if this is going to make it.
Flags: blocking1.8b5? → blocking1.8b5+
Whiteboard: DUPEME
Attachment #197590 - Flags: superreview?(brendan)
Attachment #197590 - Flags: review?(shaver)
Comment on attachment 197590 [details] [diff] [review]
Allow / in char classes

Attachment #197590 - Flags: superreview?(brendan) → superreview+
Attachment #197590 - Flags: review?(shaver) → review?(brendan)
we're not going to hold the release for this but if it comes to us with full
reviews and it's low risk, we can talk.
Flags: blocking1.8b5+ → blocking1.8b5-
Comment on attachment 197590 [details] [diff] [review]
Allow / in char classes

Yeah, this is safe.  The only way to close a character class is with an
unescaped ], and you can't nest character classes, so a boolean suffices.

Attachment #197590 - Flags: review?(brendan)
Attachment #197590 - Flags: review+
Attachment #197590 - Flags: approval1.8b5?
Fix checked into trunk.
Closed: 19 years ago
Resolution: --- → FIXED
Attachment #197590 - Flags: approval1.8b5? → approval1.8b5+
Comment on attachment 197590 [details] [diff] [review]
Allow / in char classes

This fixes a highly dup'ed IE compatibility bug.  It's an extension to ECMA
syntax	that's allowed by Section 16.  I'm approving it so that we can get it
into 1.8b5 / Firefox 1.5b2.

Don't forget to set fixed1.8 when this lands on the branch tonight.

Flags: blocking1.8b5- → blocking1.8b5+
Checked into MOZILLA_1_8_BRANCH.
Keywords: fixed1.8
*** Bug 235508 has been marked as a duplicate of this bug. ***
*** Bug 212822 has been marked as a duplicate of this bug. ***
*** Bug 224988 has been marked as a duplicate of this bug. ***
Checking in regress-309840.js;
/cvsroot/mozilla/js/tests/ecma_3/RegExp/regress-309840.js,v  <--  regress-309840.js
initial revision: 1.1

obsoletes js1_5/Regress/regress-173067.js
Flags: testcase+
*** Bug 318303 has been marked as a duplicate of this bug. ***
verified fixed 200604-1, 1.8, 1.9a1 win/mac/linux
Keywords: fixed1.8verified1.8
note to self: ecma_3/RegExp/regress-309840.js timed out on peach 1.8 debug browser, but not on prune. Could not reproduce manually.
You need to log in before you can comment on or make changes to this bug.