I'm having trouble with some invalid javascript, which is breaking collapsible fieldsets and other things. The firebug console gives:

invalid quantifier
extExclude = new RegExp(Drupal.settings.extlink.extExclude.replace(/\\/, '\\'))
extlink.js (line 33)

I suppose this may be due to an invalid regular expression (I can't remember if I entered any), but the problem is I cannot edit it (that fieldset is broken because of the problem).

I tried disabling and uninstalling extlink, but when I enable the module again afterwards the problem returns. Could an (invalid) regular expression remain in the database after uninstalling? Otherwise there may be an incompatibility with Domain Access (I'm using different domains).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quicksketch’s picture

I suppose this may be due to an invalid regular expression (I can't remember if I entered any), but the problem is I cannot edit it (that fieldset is broken because of the problem).

Disable JavaScript in your browser and empty our your regular expressions while JS is turned off.

ar-jan’s picture

Status: Active » Fixed

Thanks, that worked. (Wondering: how come uninstalling and clearing cache didn't clear the regex?).

arvinsingla’s picture

Status: Fixed » Needs review
FileSize
1.7 KB

I'm re-opening this issue as It seems there are two issues this brings up with external links that need to be addressed. First is that the module does not remove it's variables on uninstall, the second is that the include/exclude form fields are not being validated for proper regex. This can lead to the aforementioned javascript issues which have adverse affects on sites. I've made a patch that I think addresses these issues but needs to be reviewed as I'm not sure if I'm going about the rejex testing in a proper way, but it seems to work for the tests I've thrown at it.

quicksketch’s picture

Title: Javascript / regex problem: invalid quantifier » Remove variables on uninstall() and validate regexs (to prevent Javascript / regex problem: invalid quantifier)
Category: support » feature

Thanks, good suggestions. I'll review these next time I'm working on External Links.

katbailey’s picture

This reroll, actually by Andrew Yang not me, fixes comments and tidies things up generally...

ar-jan’s picture

Status: Needs review » Reviewed & tested by the community

The patch in #5 applies cleanly to 7.x-1.12 (don't have git installed, no -dev release?).
I don't know if there are coding issues, but I've tested it for preventing invalid regular expressions, that seems to work. Setting to reviewed & tested to bump this ;).

elachlan’s picture

Title: Remove variables on uninstall() and validate regexs (to prevent Javascript / regex problem: invalid quantifier) » Validate regexs (to prevent Javascript / regex problem: invalid quantifier)
Status: Reviewed & tested by the community » Needs review
FileSize
1.22 KB

Issue #1203940: use hook_uninstall to completly remove extlink adds the hook_uninstall(). It is better to have separate issues and different commits.

I have re-rolled the patch.

elachlan’s picture

Status: Needs review » Fixed

Committed to Git for versions 6.x and 7.x.

elachlan’s picture

Status: Fixed » Closed (fixed)