*** libxml2-2.6.31-orig/xinclude.c	2008-02-04 10:07:26.000000000 -0500
--- libxml2-2.6.31/xinclude.c	2008-02-06 09:54:12.000000000 -0500
***************
*** 516,524 ****
  	href = xmlStrdup(BAD_CAST ""); /* @@@@ href is now optional */
  	if (href == NULL) 
  	    return(-1);
- 	local = 1;
      }
!     if (href[0] == '#')
  	local = 1;
      parse = xmlXIncludeGetProp(ctxt, cur, XINCLUDE_PARSE);
      if (parse != NULL) {
--- 516,523 ----
  	href = xmlStrdup(BAD_CAST ""); /* @@@@ href is now optional */
  	if (href == NULL) 
  	    return(-1);
      }
!     if (href[0] == '#' || xmlStrEqual(href,""))
  	local = 1;
      parse = xmlXIncludeGetProp(ctxt, cur, XINCLUDE_PARSE);
      if (parse != NULL) {
***************
*** 617,622 ****
--- 616,632 ----
      }
  
      /*
+      * If local and xml then we need a fragment
+      */
+     if ((local == 1) && (xml == 1) && ((fragment==NULL) || (xmlStrEqual(fragment,"")))) {
+ 	xmlXIncludeErr(ctxt, cur, XML_XINCLUDE_RECURSION,
+ 	               "detected a local recursion with no xpointer in %s\n", URL);
+ 	if (fragment != NULL)
+ 	    xmlFree(fragment);
+ 	return(-1);
+     }
+ 
+     /*
       * Check the URL against the stack for recursions
       */
      if ((!local) && (xml == 1)) {
