Diff for /embedaddon/php/ext/dom/document.c between versions 1.1.1.1 and 1.1.1.2

version 1.1.1.1, 2012/02/21 23:47:54 version 1.1.1.2, 2012/05/29 12:34:37
Line 149  ZEND_END_ARG_INFO(); Line 149  ZEND_END_ARG_INFO();
   
 ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_loadhtml, 0, 0, 1)  ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_loadhtml, 0, 0, 1)
         ZEND_ARG_INFO(0, source)          ZEND_ARG_INFO(0, source)
           ZEND_ARG_INFO(0, options)
 ZEND_END_ARG_INFO();  ZEND_END_ARG_INFO();
   
 ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_loadhtmlfile, 0, 0, 1)  ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_loadhtmlfile, 0, 0, 1)
         ZEND_ARG_INFO(0, source)          ZEND_ARG_INFO(0, source)
           ZEND_ARG_INFO(0, options)
 ZEND_END_ARG_INFO();  ZEND_END_ARG_INFO();
   
 ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_savehtml, 0, 0, 0)  ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_savehtml, 0, 0, 0)
Line 259  int dom_document_doctype_read(dom_object *obj, zval ** Line 261  int dom_document_doctype_read(dom_object *obj, zval **
                 return SUCCESS;                  return SUCCESS;
         }          }
   
        if (NULL == (*retval = php_dom_create_object((xmlNodePtr) dtdptr, &ret, NULL, *retval, obj TSRMLS_CC))) {        if (NULL == (*retval = php_dom_create_object((xmlNodePtr) dtdptr, &ret, *retval, obj TSRMLS_CC))) {
                 php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create required DOM object");                  php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create required DOM object");
                 return FAILURE;                  return FAILURE;
         }          }
Line 309  int dom_document_document_element_read(dom_object *obj Line 311  int dom_document_document_element_read(dom_object *obj
                 return SUCCESS;                  return SUCCESS;
         }          }
   
        if (NULL == (*retval = php_dom_create_object(root, &ret, NULL, *retval, obj TSRMLS_CC))) {        if (NULL == (*retval = php_dom_create_object(root, &ret, *retval, obj TSRMLS_CC))) {
                 php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create required DOM object");                  php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create required DOM object");
                 return FAILURE;                  return FAILURE;
         }          }
Line 899  Since:  Line 901  Since: 
 */  */
 PHP_FUNCTION(dom_document_create_element)  PHP_FUNCTION(dom_document_create_element)
 {  {
        zval *id, *rv = NULL;        zval *id;
         xmlNode *node;          xmlNode *node;
         xmlDocPtr docp;          xmlDocPtr docp;
         dom_object *intern;          dom_object *intern;
Line 922  PHP_FUNCTION(dom_document_create_element) Line 924  PHP_FUNCTION(dom_document_create_element)
                 RETURN_FALSE;                  RETURN_FALSE;
         }          }
   
        DOM_RET_OBJ(rv, node, &ret, intern);        DOM_RET_OBJ(node, &ret, intern);
 }  }
 /* }}} end dom_document_create_element */  /* }}} end dom_document_create_element */
   
Line 932  Since:  Line 934  Since: 
 */  */
 PHP_FUNCTION(dom_document_create_document_fragment)  PHP_FUNCTION(dom_document_create_document_fragment)
 {  {
        zval *id, *rv = NULL;        zval *id;
         xmlNode *node;          xmlNode *node;
         xmlDocPtr docp;          xmlDocPtr docp;
         dom_object *intern;          dom_object *intern;
Line 949  PHP_FUNCTION(dom_document_create_document_fragment) Line 951  PHP_FUNCTION(dom_document_create_document_fragment)
                 RETURN_FALSE;                  RETURN_FALSE;
         }          }
   
        DOM_RET_OBJ(rv, node, &ret, intern);        DOM_RET_OBJ(node, &ret, intern);
 }  }
 /* }}} end dom_document_create_document_fragment */  /* }}} end dom_document_create_document_fragment */
   
Line 959  Since:  Line 961  Since: 
 */  */
 PHP_FUNCTION(dom_document_create_text_node)  PHP_FUNCTION(dom_document_create_text_node)
 {  {
        zval *id, *rv = NULL;        zval *id;
         xmlNode *node;          xmlNode *node;
         xmlDocPtr docp;          xmlDocPtr docp;
         int ret, value_len;          int ret, value_len;
Line 977  PHP_FUNCTION(dom_document_create_text_node) Line 979  PHP_FUNCTION(dom_document_create_text_node)
                 RETURN_FALSE;                  RETURN_FALSE;
         }          }
   
        DOM_RET_OBJ(rv, node, &ret, intern);        DOM_RET_OBJ(node, &ret, intern);
 }  }
 /* }}} end dom_document_create_text_node */  /* }}} end dom_document_create_text_node */
   
Line 987  Since:  Line 989  Since: 
 */  */
 PHP_FUNCTION(dom_document_create_comment)  PHP_FUNCTION(dom_document_create_comment)
 {  {
        zval *id, *rv = NULL;        zval *id;
         xmlNode *node;          xmlNode *node;
         xmlDocPtr docp;          xmlDocPtr docp;
         int ret, value_len;          int ret, value_len;
Line 1005  PHP_FUNCTION(dom_document_create_comment) Line 1007  PHP_FUNCTION(dom_document_create_comment)
                 RETURN_FALSE;                  RETURN_FALSE;
         }          }
   
        DOM_RET_OBJ(rv, node, &ret, intern);        DOM_RET_OBJ(node, &ret, intern);
 }  }
 /* }}} end dom_document_create_comment */  /* }}} end dom_document_create_comment */
   
Line 1015  Since:  Line 1017  Since: 
 */  */
 PHP_FUNCTION(dom_document_create_cdatasection)  PHP_FUNCTION(dom_document_create_cdatasection)
 {  {
        zval *id, *rv = NULL;        zval *id;
         xmlNode *node;          xmlNode *node;
         xmlDocPtr docp;          xmlDocPtr docp;
         int ret, value_len;          int ret, value_len;
Line 1033  PHP_FUNCTION(dom_document_create_cdatasection) Line 1035  PHP_FUNCTION(dom_document_create_cdatasection)
                 RETURN_FALSE;                  RETURN_FALSE;
         }          }
   
        DOM_RET_OBJ(rv, node, &ret, intern);        DOM_RET_OBJ(node, &ret, intern);
 }  }
 /* }}} end dom_document_create_cdatasection */  /* }}} end dom_document_create_cdatasection */
   
Line 1043  Since:  Line 1045  Since: 
 */  */
 PHP_FUNCTION(dom_document_create_processing_instruction)  PHP_FUNCTION(dom_document_create_processing_instruction)
 {  {
        zval *id, *rv = NULL;        zval *id;
         xmlNode *node;          xmlNode *node;
         xmlDocPtr docp;          xmlDocPtr docp;
         int ret, value_len, name_len = 0;          int ret, value_len, name_len = 0;
Line 1068  PHP_FUNCTION(dom_document_create_processing_instructio Line 1070  PHP_FUNCTION(dom_document_create_processing_instructio
   
         node->doc = docp;          node->doc = docp;
   
        DOM_RET_OBJ(rv, node, &ret, intern);        DOM_RET_OBJ(node, &ret, intern);
 }  }
 /* }}} end dom_document_create_processing_instruction */  /* }}} end dom_document_create_processing_instruction */
   
Line 1078  Since:  Line 1080  Since: 
 */  */
 PHP_FUNCTION(dom_document_create_attribute)  PHP_FUNCTION(dom_document_create_attribute)
 {  {
        zval *id, *rv = NULL;        zval *id;
         xmlAttrPtr node;          xmlAttrPtr node;
         xmlDocPtr docp;          xmlDocPtr docp;
         int ret, name_len;          int ret, name_len;
Line 1101  PHP_FUNCTION(dom_document_create_attribute) Line 1103  PHP_FUNCTION(dom_document_create_attribute)
                 RETURN_FALSE;                  RETURN_FALSE;
         }          }
   
        DOM_RET_OBJ(rv, (xmlNodePtr) node, &ret, intern);        DOM_RET_OBJ((xmlNodePtr) node, &ret, intern);
   
 }  }
 /* }}} end dom_document_create_attribute */  /* }}} end dom_document_create_attribute */
Line 1112  Since:  Line 1114  Since: 
 */  */
 PHP_FUNCTION(dom_document_create_entity_reference)  PHP_FUNCTION(dom_document_create_entity_reference)
 {  {
        zval *id, *rv = NULL;        zval *id;
         xmlNode *node;          xmlNode *node;
         xmlDocPtr docp = NULL;          xmlDocPtr docp = NULL;
         dom_object *intern;          dom_object *intern;
Line 1135  PHP_FUNCTION(dom_document_create_entity_reference) Line 1137  PHP_FUNCTION(dom_document_create_entity_reference)
                 RETURN_FALSE;                  RETURN_FALSE;
         }          }
   
        DOM_RET_OBJ(rv, (xmlNodePtr) node, &ret, intern);        DOM_RET_OBJ((xmlNodePtr) node, &ret, intern);
 }  }
 /* }}} end dom_document_create_entity_reference */  /* }}} end dom_document_create_entity_reference */
   
Line 1171  Since: DOM Level 2 Line 1173  Since: DOM Level 2
 */  */
 PHP_FUNCTION(dom_document_import_node)  PHP_FUNCTION(dom_document_import_node)
 {  {
         zval *rv = NULL;  
         zval *id, *node;          zval *id, *node;
         xmlDocPtr docp;          xmlDocPtr docp;
         xmlNodePtr nodep, retnodep;          xmlNodePtr nodep, retnodep;
Line 1211  PHP_FUNCTION(dom_document_import_node) Line 1212  PHP_FUNCTION(dom_document_import_node)
                         nsptr = xmlSearchNsByHref (nodep->doc, root, nodep->ns->href);                          nsptr = xmlSearchNsByHref (nodep->doc, root, nodep->ns->href);
                         if (nsptr == NULL) {                          if (nsptr == NULL) {
                                 int errorcode;                                  int errorcode;
                                nsptr = dom_get_ns(root, nodep->ns->href, &errorcode, nodep->ns->prefix);                                nsptr = dom_get_ns(root, (char *) nodep->ns->href, &errorcode, (char *) nodep->ns->prefix);
                         }                          }
                         xmlSetNs(retnodep, nsptr);                          xmlSetNs(retnodep, nsptr);
                 }                  }
         }          }
   
        DOM_RET_OBJ(rv, (xmlNodePtr) retnodep, &ret, intern);        DOM_RET_OBJ((xmlNodePtr) retnodep, &ret, intern);
 }  }
 /* }}} end dom_document_import_node */  /* }}} end dom_document_import_node */
   
Line 1227  Since: DOM Level 2 Line 1228  Since: DOM Level 2
 */  */
 PHP_FUNCTION(dom_document_create_element_ns)  PHP_FUNCTION(dom_document_create_element_ns)
 {  {
        zval *id, *rv = NULL;        zval *id;
         xmlDocPtr docp;          xmlDocPtr docp;
         xmlNodePtr nodep = NULL;          xmlNodePtr nodep = NULL;
         xmlNsPtr nsptr = NULL;          xmlNsPtr nsptr = NULL;
Line 1280  PHP_FUNCTION(dom_document_create_element_ns) Line 1281  PHP_FUNCTION(dom_document_create_element_ns)
                   
         nodep->ns = nsptr;          nodep->ns = nsptr;
   
        DOM_RET_OBJ(rv, nodep, &ret, intern);        DOM_RET_OBJ(nodep, &ret, intern);
 }  }
 /* }}} end dom_document_create_element_ns */  /* }}} end dom_document_create_element_ns */
   
Line 1290  Since: DOM Level 2 Line 1291  Since: DOM Level 2
 */  */
 PHP_FUNCTION(dom_document_create_attribute_ns)  PHP_FUNCTION(dom_document_create_attribute_ns)
 {  {
        zval *id, *rv = NULL;        zval *id;
         xmlDocPtr docp;          xmlDocPtr docp;
         xmlNodePtr nodep = NULL, root;          xmlNodePtr nodep = NULL, root;
         xmlNsPtr nsptr;          xmlNsPtr nsptr;
Line 1345  PHP_FUNCTION(dom_document_create_attribute_ns) Line 1346  PHP_FUNCTION(dom_document_create_attribute_ns)
                 RETURN_FALSE;                  RETURN_FALSE;
         }          }
   
        DOM_RET_OBJ(rv, nodep, &ret, intern);        DOM_RET_OBJ(nodep, &ret, intern);
 }  }
 /* }}} end dom_document_create_attribute_ns */  /* }}} end dom_document_create_attribute_ns */
   
Line 1382  Since: DOM Level 2 Line 1383  Since: DOM Level 2
 */  */
 PHP_FUNCTION(dom_document_get_element_by_id)  PHP_FUNCTION(dom_document_get_element_by_id)
 {  {
        zval *id, *rv = NULL;        zval *id;
         xmlDocPtr docp;          xmlDocPtr docp;
         xmlAttrPtr  attrp;          xmlAttrPtr  attrp;
         int ret, idname_len;          int ret, idname_len;
Line 1398  PHP_FUNCTION(dom_document_get_element_by_id) Line 1399  PHP_FUNCTION(dom_document_get_element_by_id)
         attrp = xmlGetID(docp, (xmlChar *) idname);          attrp = xmlGetID(docp, (xmlChar *) idname);
   
         if (attrp && attrp->parent) {          if (attrp && attrp->parent) {
                DOM_RET_OBJ(rv, (xmlNodePtr) attrp->parent, &ret, intern);                DOM_RET_OBJ((xmlNodePtr) attrp->parent, &ret, intern);
         } else {          } else {
                 RETVAL_NULL();                  RETVAL_NULL();
         }          }
Line 1660  static xmlDocPtr dom_document_parser(zval *id, int mod Line 1661  static xmlDocPtr dom_document_parser(zval *id, int mod
   
 /* {{{ static void dom_parse_document(INTERNAL_FUNCTION_PARAMETERS, int mode) */  /* {{{ static void dom_parse_document(INTERNAL_FUNCTION_PARAMETERS, int mode) */
 static void dom_parse_document(INTERNAL_FUNCTION_PARAMETERS, int mode) {  static void dom_parse_document(INTERNAL_FUNCTION_PARAMETERS, int mode) {
        zval *id, *rv = NULL;        zval *id;
         xmlDoc *docp = NULL, *newdoc;          xmlDoc *docp = NULL, *newdoc;
         dom_doc_propsptr doc_prop;          dom_doc_propsptr doc_prop;
         dom_object *intern;          dom_object *intern;
Line 1712  static void dom_parse_document(INTERNAL_FUNCTION_PARAM Line 1713  static void dom_parse_document(INTERNAL_FUNCTION_PARAM
   
                 RETURN_TRUE;                  RETURN_TRUE;
         } else {          } else {
                DOM_RET_OBJ(rv, (xmlNodePtr) newdoc, &ret, NULL);                DOM_RET_OBJ((xmlNodePtr) newdoc, &ret, NULL);
         }          }
 }  }
 /* }}} end dom_parser_document */  /* }}} end dom_parser_document */
Line 1979  static void _dom_document_schema_validate(INTERNAL_FUN Line 1980  static void _dom_document_schema_validate(INTERNAL_FUN
         int                     is_valid;          int                     is_valid;
         char resolved_path[MAXPATHLEN + 1];          char resolved_path[MAXPATHLEN + 1];
   
        if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &source, &source_len) == FAILURE) {        if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Op", &id, dom_document_class_entry, &source, &source_len) == FAILURE) {
                 return;                  return;
         }          }
   
Line 2068  static void _dom_document_relaxNG_validate(INTERNAL_FU Line 2069  static void _dom_document_relaxNG_validate(INTERNAL_FU
         int                     is_valid;          int                     is_valid;
         char resolved_path[MAXPATHLEN + 1];          char resolved_path[MAXPATHLEN + 1];
   
        if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &source, &source_len) == FAILURE) {        if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Op", &id, dom_document_class_entry, &source, &source_len) == FAILURE) {
                 return;                  return;
         }          }
   
Line 2150  PHP_FUNCTION(dom_document_relaxNG_validate_xml) Line 2151  PHP_FUNCTION(dom_document_relaxNG_validate_xml)
   
 static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */  static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
 {  {
        zval *id, *rv = NULL;        zval *id;
         xmlDoc *docp = NULL, *newdoc;          xmlDoc *docp = NULL, *newdoc;
         dom_object *intern;          dom_object *intern;
         dom_doc_propsptr doc_prop;          dom_doc_propsptr doc_prop;
         char *source;          char *source;
         int source_len, refcount, ret;          int source_len, refcount, ret;
           long options = 0;
         htmlParserCtxtPtr ctxt;          htmlParserCtxtPtr ctxt;
                   
         id = getThis();          id = getThis();
   
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &source, &source_len) == FAILURE) {        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &source, &source_len, &options) == FAILURE) {
                 return;                  return;
         }          }
   
Line 2180  static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS Line 2182  static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS
                 RETURN_FALSE;                  RETURN_FALSE;
         }          }
   
           if (options) {
                   htmlCtxtUseOptions(ctxt, options);
           }
   
         ctxt->vctxt.error = php_libxml_ctx_error;          ctxt->vctxt.error = php_libxml_ctx_error;
         ctxt->vctxt.warning = php_libxml_ctx_warning;          ctxt->vctxt.warning = php_libxml_ctx_warning;
         if (ctxt->sax != NULL) {          if (ctxt->sax != NULL) {
Line 2218  static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS Line 2224  static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS
   
                 RETURN_TRUE;                  RETURN_TRUE;
         } else {          } else {
                DOM_RET_OBJ(rv, (xmlNodePtr) newdoc, &ret, NULL);                DOM_RET_OBJ((xmlNodePtr) newdoc, &ret, NULL);
         }          }
 }  }
 /* }}} */  /* }}} */

Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.2


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>