rrichards               Sun Nov 21 09:26:26 2004 EDT

  Modified files:              (Branch: PHP_5_0)
    /php-src/ext/xml    compat.c 
  Log:
  MFH: internal entities expanded if no default handler but cdata handler exists
  
http://cvs.php.net/diff.php/php-src/ext/xml/compat.c?r1=1.32.2.5&r2=1.32.2.6&ty=u
Index: php-src/ext/xml/compat.c
diff -u php-src/ext/xml/compat.c:1.32.2.5 php-src/ext/xml/compat.c:1.32.2.6
--- php-src/ext/xml/compat.c:1.32.2.5   Thu Nov 18 15:16:45 2004
+++ php-src/ext/xml/compat.c    Sun Nov 21 09:26:26 2004
@@ -278,7 +278,6 @@
                if (ret == NULL)
                        ret = xmlGetDocEntity(parser->parser->myDoc, name);
 
-       
                if (ret == NULL || (parser->parser->instate != 
XML_PARSER_ENTITY_VALUE && parser->parser->instate != 
XML_PARSER_ATTRIBUTE_VALUE)) {
                        if (ret == NULL || ret->etype == 
XML_INTERNAL_GENERAL_ENTITY || ret->etype == XML_INTERNAL_PARAMETER_ENTITY || 
ret->etype == XML_INTERNAL_PREDEFINED_ENTITY) {
                                if (parser->h_default) {
@@ -288,6 +287,12 @@
                                        _build_entity(name, xmlStrlen(name), 
&entity, &len);
                                        parser->h_default(parser->user, (const 
xmlChar *) entity, len);
                                        xmlFree(entity);
+                               } else {
+                                       /* expat will not expand internal 
entities if default handler is present otherwise
+                                       it will expand and pass them to cdata 
handler */
+                                       if (parser->h_cdata && ret) {
+                                               parser->h_cdata(parser->user, 
ret->content, xmlStrlen(ret->content));
+                                       }
                                }
                        } else {
                                if (ret->etype == 
XML_EXTERNAL_GENERAL_PARSED_ENTITY) {

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to