Skip to content

Commit

Permalink
Fix scanning for regex vs. division
Browse files Browse the repository at this point in the history
  • Loading branch information
slusarz authored and mrubinsk committed Nov 14, 2013
1 parent 2c12081 commit fc6a6a6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion framework/Text_Filter_Jsmin/lib/Horde/Text/Filter/Jsmin.php
Expand Up @@ -240,7 +240,8 @@ protected function _isAlphaNum($c)

protected function _isRegexLiteral($oldindex)
{
if (strspn($this->_a, "(,=:[!&|?+-~*/{\n ")) {
/* We aren't dividing. */
if (strspn($this->_a, "(,=:[!&|?+-~*/{;")) {
return true;
}

Expand Down
Expand Up @@ -72,6 +72,13 @@ public function testBug12787()
'function foo(a){return/\//.test(a);}',
Horde_Text_Filter::filter($js, 'JavascriptMinify')
);

$js2 = 'var a = 0, b = c / 100 | 0;';

$this->assertNotEquals(
$js2,
Horde_Text_Filter::filter($js2, 'JavascriptMinify')
);
}

}

0 comments on commit fc6a6a6

Please sign in to comment.