Index: lucene/src/test/org/apache/lucene/search/TestPhraseQuery.java
===================================================================
--- lucene/src/test/org/apache/lucene/search/TestPhraseQuery.java	(revision 1137477)
+++ lucene/src/test/org/apache/lucene/search/TestPhraseQuery.java	(working copy)
@@ -22,11 +22,14 @@
 import org.apache.lucene.analysis.tokenattributes.*;
 import org.apache.lucene.document.*;
 import org.apache.lucene.index.*;
+import org.apache.lucene.index.IndexReader.AtomicReaderContext;
 import org.apache.lucene.index.IndexWriterConfig.OpenMode;
 import org.apache.lucene.queryParser.QueryParser;
 import org.apache.lucene.store.*;
 import org.apache.lucene.util.Version;
 import org.apache.lucene.util._TestUtil;
+import org.apache.lucene.util.automaton.CharacterRunAutomaton;
+import org.apache.lucene.util.automaton.RegExp;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 
@@ -694,4 +697,77 @@
     s.close();
     dir.close();
   }
+  
+  public void testInfiniteFreq() throws Exception {
+    String document = 
+      "So much fun to be had in my head " +
+      "No more sunshine " +
+      "So much fun just lying in my bed " +
+      "No more sunshine " +
+      "I can't face the sunlight and the dirt outside " +
+      "Wanna stay in 666 where this darkness don't lie " +
+      "Drug drug druggy " +
+      "Got a feeling sweet like honey " +
+      "Drug drug druggy " +
+      "Need sensation like my baby " +
+      "Show me your scars you're so aware " +
+      "I'm not barbaric I just care " +
+      "Drug drug drug " +
+      "I need a reflection to prove I exist " +
+      "No more sunshine " +
+      "I am a victim of designer blitz " +
+      "No more sunshine " +
+      "Dance like a robot when you're chained at the knee " +
+      "The C.I.A say you're all they'll ever need " +
+      "Drug drug druggy " +
+      "Got a feeling sweet like honey " +
+      "Drug drug druggy " +
+      "Need sensation like my baby " +
+      "Snort your lines you're so aware " +
+      "I'm not barbaric I just care " +
+      "Drug drug druggy " +
+      "Got a feeling sweet like honey " +
+      "Drug drug druggy " +
+      "Need sensation like my baby";
+    
+    Directory dir = newDirectory();
+    CharacterRunAutomaton stopSet = new CharacterRunAutomaton(new RegExp("the|a|to|be").toAutomaton());
+    MockAnalyzer analyzer = new MockAnalyzer(random, MockTokenizer.WHITESPACE, true, stopSet, true);
+    RandomIndexWriter iw = new RandomIndexWriter(random, dir, analyzer);
+    Document doc = new Document();
+    doc.add(newField("lyrics", document, Field.Index.ANALYZED));
+    iw.addDocument(doc);
+    IndexReader ir = iw.getReader();
+    iw.close();
+    
+    IndexSearcher is = newSearcher(ir);
+    Query pq = new QueryParser(TEST_VERSION_CURRENT, "lyrics", analyzer).parse("\"drug the drug\"~5");
+    is.search(pq, new Collector() {
+      Scorer scorer;
+
+      @Override
+      public void setScorer(Scorer scorer) throws IOException {
+        this.scorer = scorer;
+      }
+
+      @Override
+      public void collect(int doc) throws IOException {
+        assertFalse(Float.isInfinite(scorer.freq()));
+        assertFalse(Float.isInfinite(scorer.score()));
+      }
+
+      @Override
+      public void setNextReader(AtomicReaderContext context) throws IOException {
+      }
+
+      @Override
+      public boolean acceptsDocsOutOfOrder() {
+        return false;
+      }
+    });
+    System.out.println(is.explain(pq, 0));
+    is.close();
+    ir.close();
+    dir.close();
+  }
 }
