fixed a serious problem when substituing entities using the Reader, the

* parser.c xmlreader.c include/libxml/parser.h: fixed a serious
  problem when substituing entities using the Reader, the entities
  content might be freed and if rereferenced would crash
* Makefile.am test/* result/*: added a new test case and a new
  test operation for the reader with substitution of entities.
Daniel
diff --git a/xmlreader.c b/xmlreader.c
index f3225aa..c6fc007 100644
--- a/xmlreader.c
+++ b/xmlreader.c
@@ -1224,6 +1224,7 @@
 	    reader->state = XML_TEXTREADER_ELEMENT;
 	}
 	reader->depth = 0;
+	reader->ctxt->parseMode = XML_PARSE_READER;
 	goto node_found;
     }
     oldstate = reader->state;
@@ -1920,6 +1921,7 @@
 	ret->base = 0;
 	ret->cur = 0;
     }
+    
     if (ret->ctxt == NULL) {
         xmlGenericError(xmlGenericErrorContext,
 		"xmlNewTextReader : malloc failed\n");
@@ -1927,6 +1929,7 @@
 	xmlFree(ret);
 	return(NULL);
     }
+    ret->ctxt->parseMode = XML_PARSE_READER;
     ret->ctxt->_private = ret;
     ret->ctxt->linenumbers = 1;
     ret->ctxt->dictNames = 1;
@@ -4231,6 +4234,7 @@
      * use the parser dictionnary to allocate all elements and attributes names
      */
     reader->ctxt->docdict = 1;
+    reader->ctxt->parseMode = XML_PARSE_READER;
 
 #ifdef LIBXML_XINCLUDE_ENABLED
     if (reader->xincctxt != NULL) {