Make WordPress Core

Opened 13 years ago

Closed 13 years ago

#21175 closed defect (bug) (invalid)

Found a bug in JavaScript program

Reported by: umarfarooque's profile UmarFarooque Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Editor Keywords:
Focuses: Cc:

Description

Hello Sir. I found a bug in Wordpress' JavaScript Section: wp-admin/js/ folder in file word-count.js. When looking around the files of Wordpress, I opened this file in Macromedia Dreamweaver 8 and saw 90% of the code blue (I'm quite sure that something's wrong).
I didn't find any double commas. I mean, there's a single or double quote is missing there.

Attachments (1)

21175.patch (572 bytes) - added by SergeyBiryukov 13 years ago.

Download all attachments as: .zip

Change History (13)

#1 @ocean90
13 years ago

  • Component changed from Formatting to General
  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed
  • Version 3.3.2 deleted

You should use a better editor. :)
The file is okay. Seems like your editor doesn't like the regex lines (see line 6).

#2 @markoheijnen
13 years ago

  • Keywords dev-feedback added
  • Milestone set to Awaiting Review
  • Resolution invalid deleted
  • Status changed from closed to reopened

I reopen the ticket because I would love to have a clarification about the usage of ^ in the strip regex. It seems insecure.

Also wonder the double \\ in the clean regex. Can it be that one of them was meant for the minus. This causes Dreamweaver and also Coda to make the rest blue/green

Last edited 13 years ago by markoheijnen (previous) (diff)

#3 @dd32
13 years ago

The *.js files are minified, this will usually cause some applications to dispay the syntax highlighting incorrectly. Instead, you should be looking at the *.dev.js files.

#4 @markoheijnen
13 years ago

I did look at the dev.js file. I used http://www.jslint.com/ to find a reason why it happen and it was because of \\ in the clean regex

#5 follow-up: @SergeyBiryukov
13 years ago

  • Component changed from General to Editor
  • Keywords has-patch added

Has been this way since the script was introduced in [7854].

Looking at the clean regex, seems that all three last characters should be escaped (21175.patch).

^ in the strip regex seems valid considering the use case.

#6 in reply to: ↑ 5 @azaozz
13 years ago

  • Keywords dev-feedback removed

Yeah, many highlighters get confused by regex patterns.

Replying to SergeyBiryukov:

Looking at the clean regex, seems that all three last characters should be escaped

Not necessary when inside a character set, /[\\/-]+/ matches one or more of /, \, and -.

#7 @SergeyBiryukov
13 years ago

The ticket resembles #11940.

#8 @azaozz
13 years ago

Right :) Perhaps one more backslash can be added there to make it more readable and maybe make it parseable by highlighters. It wouldn't change the way it works.

#9 @SergeyBiryukov
13 years ago

JSLint (comment:4) insists on both slashes :)

line 6 character 44
Unescaped '/'.
line 6 character 46
Unescaped '-'.
Last edited 13 years ago by SergeyBiryukov (previous) (diff)

#10 @azaozz
13 years ago

Well, JSLint is wrong here. A dash as the first or last char in a character set (a.k.a. character class) doesn't need escaping.

The "line 6 character 44 Unescaped '/'" is wrong too or the regex would throw parse error. As far as I know /[/]/ works as expected and the / doesn't need escaping inside [] (same as a dot).

Last edited 13 years ago by azaozz (previous) (diff)

#11 @SergeyBiryukov
13 years ago

Yes, that's what I've found out as well. Seems invalid then.

#12 @azaozz
13 years ago

  • Keywords has-patch removed
  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from reopened to closed

Invalid based on the last few comments.

Note: See TracTickets for help on using tickets.