[LON-CAPA-cvs] cvs: loncom /xml scripttag.pm

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 15 Jul 2004 16:43:37 -0000


albertel		Thu Jul 15 12:43:37 2004 EDT

  Modified files:              
    /loncom/xml	scripttag.pm 
  Log:
  - BUG# 3208 &chemparse in the bodytext causes an infinite parse recursion.
  
  
Index: loncom/xml/scripttag.pm
diff -u loncom/xml/scripttag.pm:1.112 loncom/xml/scripttag.pm:1.113
--- loncom/xml/scripttag.pm:1.112	Thu Apr 15 16:24:34 2004
+++ loncom/xml/scripttag.pm	Thu Jul 15 12:43:37 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # <script> definiton
 #
-# $Id: scripttag.pm,v 1.112 2004/04/15 20:24:34 albertel Exp $
+# $Id: scripttag.pm,v 1.113 2004/07/15 16:43:37 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -483,7 +483,14 @@
 sub xmlparse {
   my ($string) = @_;
   &Apache::lonxml::debug("xmlparse recursion starting with $string");
+  # Apache::run::evaluate does an 'eval' on the name of the subroutine
+  # if it detects something that looks like a subroutine, this ends up calling
+  # things without any arguments and since perl is nice enough to pass
+  # along the default arguments when you don't explicitly say no arguments
+  # if you call &xmlparse, it gets &xmlparse passed as it argument.
+  # Same thing soccurs with &chemparse.
   if ($string eq '&xmlparse') { return '&xmlparse'; }
+  if ($string eq '&chemparse') { return '&chemparse'; }
   my ($target,$token,$tagstack,$parstack,$oldparser,$safeeval,$style)=
     @Apache::scripttag::parser_env;
   my @parser;