Index: branches/MwEmbedStandAlone/ResourceLoader.php |
— | — | @@ -878,6 +878,7 @@ |
879 | 879 | $parenthesesDepth = 0; |
880 | 880 | $ignorenext = false; |
881 | 881 | $inquote = false; |
| 882 | + $inSingleQuote = false; |
882 | 883 | for ( $i = $startOfLogIndex; $i < strlen( $jsString ); $i++ ) { |
883 | 884 | $char = $jsString[$i]; |
884 | 885 | if ( $ignorenext ) { |
— | — | @@ -886,23 +887,30 @@ |
887 | 888 | // Search for a close ) that is not in quotes |
888 | 889 | switch( $char ) { |
889 | 890 | case '"': |
890 | | - $inquote = !$inquote; |
891 | | - break; |
| 891 | + if( !$inSingleQuote ){ |
| 892 | + $inquote = !$inquote; |
| 893 | + } |
| 894 | + break; |
| 895 | + case '\'': |
| 896 | + if( !$inquote ){ |
| 897 | + $inSingleQuote = !$inSingleQuote; |
| 898 | + } |
| 899 | + break; |
892 | 900 | case '(': |
893 | | - if( ! $inquote){ |
| 901 | + if( !$inquote && !$inSingleQuote ){ |
894 | 902 | $parenthesesDepth++; |
895 | 903 | } |
896 | 904 | break; |
897 | 905 | case ')': |
898 | | - if( ! $inquote ){ |
| 906 | + if( ! $inquote && !$inSingleQuote ){ |
899 | 907 | $parenthesesDepth--; |
900 | 908 | } |
901 | 909 | break; |
902 | 910 | case '\\': |
903 | 911 | if ( $inquote ) $ignorenext = true; |
904 | | - break; |
| 912 | + break; |
905 | 913 | } |
906 | | - // done with close parentheses search for next mw.log in outer loop: |
| 914 | + // Done with close parentheses search for next mw.log in outer loop: |
907 | 915 | if( $parenthesesDepth === 0 ){ |
908 | 916 | break; |
909 | 917 | } |