diff options
author | Pierre Paysant-Le Roux <andi@splitbrain.org> | 2009-11-05 22:34:52 +0100 |
---|---|---|
committer | Pierre Paysant-Le Roux <andi@splitbrain.org> | 2009-11-05 22:34:52 +0100 |
commit | ef457c67624460b5703178e7b11edc2f9fffda01 (patch) | |
tree | fc44af2ad6fd840f856adea46acd029c3390b1c1 /lib | |
parent | fde10de4d3e3572d5078933f66833df24e1efc44 (diff) | |
download | rpg-ef457c67624460b5703178e7b11edc2f9fffda01.tar.gz rpg-ef457c67624460b5703178e7b11edc2f9fffda01.tar.bz2 |
Fix js_compress regexp detection
Ignore-this: ffb20375a09483502d61241d76877a8d
darcs-hash:20091105213452-533a7-f09aca121cf24a8b6ad2d3448d058a846cb52182.gz
Diffstat (limited to 'lib')
-rw-r--r-- | lib/exe/js.php | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/exe/js.php b/lib/exe/js.php index 0888fa57f..ab67288cd 100644 --- a/lib/exe/js.php +++ b/lib/exe/js.php @@ -282,6 +282,10 @@ function js_compress($s){ // items that don't need spaces next to them $chars = "^&|!+\-*\/%=\?:;,{}()<>% \t\n\r'\"[]"; + $regex_starters = array("(", "=", "[", "," , ":"); + + $whitespaces_chars = array(" ", "\t", "\n", "\r", "\0", "\x0B"); + while($i < $slen){ // skip all "boring" characters. This is either // reserved word (e.g. "for", "else", "if") or a @@ -312,10 +316,10 @@ function js_compress($s){ if($ch == '/'){ // rewind, skip white space $j = 1; - while($s{$i-$j} == ' '){ + while(in_array($s{$i-$j}, $whitespaces_chars)){ $j = $j + 1; } - if( ($s{$i-$j} == '=') || ($s{$i-$j} == '(') ){ + if( in_array($s{$i-$j}, $regex_starters) ){ // yes, this is an re // now move forward and find the end of it $j = 1; |