rrichards               Sun Feb 15 09:05:18 2004 EDT

  Modified files:              
    /php-src/ext/dom    node.c element.c 
  Log:
  switch to zend_parse_method_parameters for consistancy
  insure object parameters are correct class types
  convert zvals to correct type if needed for property writes
  
http://cvs.php.net/diff.php/php-src/ext/dom/node.c?r1=1.22&r2=1.23&ty=u
Index: php-src/ext/dom/node.c
diff -u php-src/ext/dom/node.c:1.22 php-src/ext/dom/node.c:1.23
--- php-src/ext/dom/node.c:1.22 Thu Jan  8 03:15:17 2004
+++ php-src/ext/dom/node.c      Sun Feb 15 09:05:17 2004
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: node.c,v 1.22 2004/01/08 08:15:17 andi Exp $ */
+/* $Id: node.c,v 1.23 2004/02/15 14:05:17 rrichards Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -205,6 +205,7 @@
 int dom_node_node_value_write(dom_object *obj, zval *newval TSRMLS_DC)
 {
        xmlNode *nodep;
+       zval value_copy;
 
        nodep = dom_object_get_node(obj);
 
@@ -219,8 +220,18 @@
                case XML_COMMENT_NODE:
                case XML_CDATA_SECTION_NODE:
                case XML_PI_NODE:
-                       convert_to_string(newval);
+                       if (newval->type != IS_STRING) {
+                               if(newval->refcount > 1) {
+                                       value_copy = *newval;
+                                       zval_copy_ctor(&value_copy);
+                                       newval = &value_copy;
+                               }
+                               convert_to_string(newval);
+                       }
                        xmlNodeSetContentLen(nodep, Z_STRVAL_P(newval), 
Z_STRLEN_P(newval) + 1);
+                       if (newval == &value_copy) {
+                               zval_dtor(newval);
+                       }
                        break;
                default:
                        break;
@@ -591,6 +602,7 @@
 
 int dom_node_prefix_write(dom_object *obj, zval *newval TSRMLS_DC)
 {
+       zval value_copy;
        xmlNode *nodep;
        xmlDocPtr doc;
        xmlNsPtr ns, curns = NULL;
@@ -602,6 +614,14 @@
        switch (nodep->type) {
                case XML_ELEMENT_NODE:
                case XML_ATTRIBUTE_NODE:
+                       if (newval->type != IS_STRING) {
+                               if(newval->refcount > 1) {
+                                       value_copy = *newval;
+                                       zval_copy_ctor(&value_copy);
+                                       newval = &value_copy;
+                               }
+                               convert_to_string(newval);
+                       }
                        prefix = Z_STRVAL_P(newval);
                        if (nodep->ns != NULL && !xmlStrEqual(nodep->ns->prefix, 
(xmlChar *)prefix)) {
                                strURI = (char *) nodep->ns->href;
@@ -610,7 +630,9 @@
                                        (nodep->type == XML_ATTRIBUTE_NODE && !strcmp 
(prefix, "xmlns") &&
                                         strcmp (strURI, DOM_XMLNS_NAMESPACE)) ||
                                        (nodep->type == XML_ATTRIBUTE_NODE && !strcmp 
(nodep->name, "xmlns"))) {
-
+                                       if (newval == &value_copy) {
+                                               zval_dtor(newval);
+                                       }
                                        php_dom_throw_error(NAMESPACE_ERR, 
dom_get_strict_error(obj->document) TSRMLS_CC);
                                        return FAILURE; 
                                }
@@ -634,6 +656,9 @@
 
                                nodep->ns = curns;
                        }
+                       if (newval == &value_copy) {
+                               zval_dtor(newval);
+                       }
                        break;
                default:
                        break;
@@ -743,17 +768,16 @@
 */
 PHP_FUNCTION(dom_node_insert_before)
 {
-       zval *id, *node, *ref, *rv = NULL;
+       zval *id, *node, *ref = NULL, *rv = NULL;
        xmlNodePtr child, new_child, parentp, refp;
        dom_object *intern, *childobj, *refpobj;
        int ret, stricterror;
 
-       DOM_GET_THIS_OBJ(parentp, id, xmlNodePtr, intern);
-
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "oo!", &node, &ref) == 
FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"OO|O!", &id, dom_node_class_entry, &node, dom_node_class_entry, &ref, 
dom_node_class_entry) == FAILURE) {
                return;
        }
 
+       DOM_GET_OBJ(parentp, id, xmlNodePtr, intern);
        DOM_GET_OBJ(child, node, xmlNodePtr, childobj);
 
        new_child = NULL;
@@ -904,16 +928,16 @@
 
        int ret;
 
-       DOM_GET_THIS_OBJ(nodep, id, xmlNodePtr, intern);
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OOO", 
&id, dom_node_class_entry, &newnode, dom_node_class_entry, &oldnode, 
dom_node_class_entry) == FAILURE) {
+               return;
+       }
+
+       DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
 
        if (dom_node_children_valid(nodep) == FAILURE) {
                RETURN_FALSE;
        }
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "oo", &newnode, &oldnode) 
== FAILURE) {
-               return;
-       }
-
        DOM_GET_OBJ(newchild, newnode, xmlNodePtr, newchildobj);
        DOM_GET_OBJ(oldchild, oldnode, xmlNodePtr, oldchildobj);
 
@@ -983,12 +1007,12 @@
        dom_object *intern, *childobj;
        int ret, stricterror;
 
-       DOM_GET_THIS_OBJ(nodep, id, xmlNodePtr, intern);
-
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &node) == FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", 
&id, dom_node_class_entry, &node, dom_node_class_entry) == FAILURE) {
                return;
        }
 
+       DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
+
        if (dom_node_children_valid(nodep) == FAILURE) {
                RETURN_FALSE;
        }
@@ -1036,12 +1060,12 @@
        dom_object *intern, *childobj;
        int ret, stricterror;
 
-       DOM_GET_THIS_OBJ(nodep, id, xmlNodePtr, intern);
-
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &node) == FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", 
&id, dom_node_class_entry, &node, dom_node_class_entry) == FAILURE) {
                return;
        }
 
+       DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
+
        if (dom_node_children_valid(nodep) == FAILURE) {
                RETURN_FALSE;
        }
@@ -1136,10 +1160,12 @@
        xmlNode *nodep;
        dom_object *intern;
 
-       DOM_GET_THIS_OBJ(nodep, id, xmlNodePtr, intern);
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", 
&id, dom_node_class_entry) == FAILURE) {
+               return;
+       }
+
+       DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
 
-       DOM_NO_ARGS();
-       
        if (dom_node_children_valid(nodep) == FAILURE) {
                RETURN_FALSE;
        }
@@ -1166,12 +1192,12 @@
        dom_object *intern;
        long recursive = 0;
 
-       DOM_GET_THIS_OBJ(n, id, xmlNodePtr, intern);
-
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &recursive) == 
FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|l", 
&id, dom_node_class_entry, &recursive) == FAILURE) {
                return;
        }
 
+       DOM_GET_OBJ(n, id, xmlNodePtr, intern);
+
        node = xmlDocCopyNode(n, n->doc, recursive);
 
        /* When deep is false Element nodes still require the attributes 
@@ -1222,9 +1248,11 @@
        xmlNode *nodep;
        dom_object *intern;
 
-       DOM_GET_THIS_OBJ(nodep, id, xmlNodePtr, intern);
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", 
&id, dom_node_class_entry) == FAILURE) {
+               return;
+       }
 
-       DOM_NO_ARGS();
+       DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
 
        dom_normalize(nodep TSRMLS_CC);
 
@@ -1238,10 +1266,11 @@
 */
 PHP_FUNCTION(dom_node_is_supported)
 {
+       zval *id;
        int feature_len, version_len;
        char *feature, *version;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &feature, 
&feature_len, &version, &version_len) == FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oss", 
&id, dom_node_class_entry, &feature, &feature_len, &version, &version_len) == FAILURE) 
{
                return;
        }
 
@@ -1264,9 +1293,11 @@
        xmlNode *nodep;
        dom_object *intern;
 
-       DOM_GET_THIS_OBJ(nodep, id, xmlNodePtr, intern);
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", 
&id, dom_node_class_entry) == FAILURE) {
+               return;
+       }
 
-       DOM_NO_ARGS();
+       DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
 
        if (nodep->type != XML_ELEMENT_NODE)
                RETURN_FALSE;
@@ -1301,12 +1332,12 @@
        xmlNodePtr nodeotherp, nodep;
        dom_object *intern, *nodeotherobj;
 
-       DOM_GET_THIS_OBJ(nodep, id, xmlNodePtr, intern);
-
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &node) == FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", 
&id, dom_node_class_entry, &node, dom_node_class_entry) == FAILURE) {
                return;
        }
 
+       DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
+
        DOM_GET_OBJ(nodeotherp, node, xmlNodePtr, nodeotherobj);
 
        if (nodep == nodeotherp) {
@@ -1331,12 +1362,12 @@
        int uri_len = 0;
        char *uri;
 
-       DOM_GET_THIS_OBJ(nodep, id, xmlNodePtr, intern);
-
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &uri, &uri_len) == 
FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", 
&id, dom_node_class_entry, &uri, &uri_len) == FAILURE) {
                return;
        }
-       
+
+       DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
+
        if (uri_len > 0) {
                switch (nodep->type) { 
                        case XML_ELEMENT_NODE:
@@ -1382,12 +1413,12 @@
        int uri_len = 0;
        char *uri;
 
-       DOM_GET_THIS_OBJ(nodep, id, xmlNodePtr, intern);
-
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &uri, &uri_len) == 
FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", 
&id, dom_node_class_entry, &uri, &uri_len) == FAILURE) {
                return;
        }
-       
+
+       DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
+
        if (uri_len > 0) {
                nsptr = xmlSearchNs(nodep->doc, nodep, NULL);
                if (nsptr && xmlStrEqual(nsptr->href, uri)) {
@@ -1413,12 +1444,12 @@
        int prefix_len = 0;
        char *prefix;
 
-       DOM_GET_THIS_OBJ(nodep, id, xmlNodePtr, intern);
-
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &prefix, 
&prefix_len) == FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", 
&id, dom_node_class_entry, &prefix, &prefix_len) == FAILURE) {
                return;
        }
-       
+
+       DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
+
        if (prefix_len > 0) {
                nsptr = xmlSearchNs(nodep->doc, nodep, prefix);
                if (nsptr && nsptr->href != NULL) {
http://cvs.php.net/diff.php/php-src/ext/dom/element.c?r1=1.23&r2=1.24&ty=u
Index: php-src/ext/dom/element.c
diff -u php-src/ext/dom/element.c:1.23 php-src/ext/dom/element.c:1.24
--- php-src/ext/dom/element.c:1.23      Thu Jan 22 16:16:05 2004
+++ php-src/ext/dom/element.c   Sun Feb 15 09:05:17 2004
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: element.c,v 1.23 2004/01/22 21:16:05 rrichards Exp $ */
+/* $Id: element.c,v 1.24 2004/02/15 14:05:17 rrichards Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -156,13 +156,12 @@
        dom_object *intern;
        int name_len;
 
-
-       DOM_GET_THIS_OBJ(nodep, id, xmlNodePtr, intern);
-
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == 
FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", 
&id, dom_element_class_entry, &name, &name_len) == FAILURE) {
                return;
        }
 
+       DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
+
        value = xmlGetProp(nodep, name);
        if (value == NULL) {
                RETURN_EMPTY_STRING();
@@ -188,12 +187,17 @@
        char *name, *value;
 
 
-       DOM_GET_THIS_OBJ(nodep, id, xmlNodePtr, intern);
-
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss",  &name, &name_len, 
&value, &value_len) == FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oss", 
&id, dom_element_class_entry, &name, &name_len, &value, &value_len) == FAILURE) {
                return;
        }
 
+       if (name_len == 0) {
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attribute Name is 
required");
+               RETURN_FALSE;
+       }
+
+       DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
+
        if (dom_node_is_read_only(nodep) == SUCCESS) {
                php_dom_throw_error(NO_MODIFICATION_ALLOWED_ERR, 
dom_get_strict_error(intern->document) TSRMLS_CC);
                RETURN_FALSE;
@@ -228,12 +232,12 @@
        int name_len;
        char *name;
 
-       DOM_GET_THIS_OBJ(nodep, id, xmlNodePtr, intern);
-
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == 
FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", 
&id, dom_element_class_entry, &name, &name_len) == FAILURE) {
                return;
        }
 
+       DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
+
        if (dom_node_is_read_only(nodep) == SUCCESS) {
                php_dom_throw_error(NO_MODIFICATION_ALLOWED_ERR, 
dom_get_strict_error(intern->document) TSRMLS_CC);
                RETURN_FALSE;
@@ -271,12 +275,12 @@
        dom_object *intern;
        char *name;
 
-       DOM_GET_THIS_OBJ(nodep, id, xmlNodePtr, intern);
-
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",  &name, &name_len) 
== FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", 
&id, dom_element_class_entry, &name, &name_len) == FAILURE) {
                return;
        }
 
+       DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
+
        attrp = xmlHasProp(nodep,name);
        if (attrp == NULL) {
                RETURN_FALSE;
@@ -299,12 +303,12 @@
        dom_object *intern, *attrobj, *oldobj;
        int ret;
 
-       DOM_GET_THIS_OBJ(nodep, id, xmlNodePtr, intern);
-
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &node) == FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", 
&id, dom_element_class_entry, &node, dom_attr_class_entry) == FAILURE) {
                return;
        }
 
+       DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
+
        if (dom_node_is_read_only(nodep) == SUCCESS) {
                php_dom_throw_error(NO_MODIFICATION_ALLOWED_ERR, 
dom_get_strict_error(intern->document) TSRMLS_CC);
                RETURN_FALSE;
@@ -357,12 +361,12 @@
        dom_object *intern, *attrobj;
        int ret;
 
-       DOM_GET_THIS_OBJ(nodep, id, xmlNodePtr, intern);
-
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o",  &node) == FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", 
&id, dom_element_class_entry, &node, dom_attr_class_entry) == FAILURE) {
                return;
        }
 
+       DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
+
        if (dom_node_is_read_only(nodep) == SUCCESS) {
                php_dom_throw_error(NO_MODIFICATION_ALLOWED_ERR, 
dom_get_strict_error(intern->document) TSRMLS_CC);
                RETURN_FALSE;
@@ -396,12 +400,12 @@
        char *name;
        xmlChar *local;
 
-       DOM_GET_THIS_OBJ(elemp, id, xmlNodePtr, intern);
-
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == 
FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", 
&id, dom_element_class_entry, &name, &name_len) == FAILURE) {
                return;
        }
 
+       DOM_GET_OBJ(elemp, id, xmlNodePtr, intern);
+
        php_dom_create_interator(return_value, DOM_NODELIST TSRMLS_CC);
        namednode = (dom_object *)zend_objects_get_address(return_value TSRMLS_CC);
        local = xmlCharStrndup(name, name_len);
@@ -423,11 +427,12 @@
        int uri_len = 0, name_len = 0;
        char *uri, *name, *strattr;
 
-       DOM_GET_THIS_OBJ(elemp, id, xmlNodePtr, intern);
-
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &uri, &uri_len, 
&name, &name_len) == FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!s", 
&id, dom_element_class_entry, &uri, &uri_len, &name, &name_len) == FAILURE) {
                return;
        }
+
+       DOM_GET_OBJ(elemp, id, xmlNodePtr, intern);
+
        strattr = xmlGetNsProp(elemp, name, uri);
 
        if (strattr != NULL) {
@@ -466,12 +471,17 @@
        dom_object *intern;
        int errorcode = 0, stricterror, is_xmlns = 0;
 
-       DOM_GET_THIS_OBJ(elemp, id, xmlNodePtr, intern);
-
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s!ss", &uri, &uri_len, 
&name, &name_len, &value, &value_len) == FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os!ss", &id, dom_element_class_entry, &uri, &uri_len, &name, &name_len, &value, 
&value_len) == FAILURE) {
                return;
        }
 
+       if (name_len == 0) {
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attribute Name is 
required");
+               RETURN_FALSE;
+       }
+
+       DOM_GET_OBJ(elemp, id, xmlNodePtr, intern);
+
        stricterror = dom_get_strict_error(intern->document);
 
        if (dom_node_is_read_only(elemp) == SUCCESS) {
@@ -557,12 +567,12 @@
        int name_len, uri_len;
        char *name, *uri;
 
-       DOM_GET_THIS_OBJ(nodep, id, xmlNodePtr, intern);
-
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &uri, &uri_len, 
&name, &name_len) == FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!s", 
&id, dom_element_class_entry, &uri, &uri_len, &name, &name_len) == FAILURE) {
                return;
        }
 
+       DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
+
        if (dom_node_is_read_only(nodep) == SUCCESS) {
                php_dom_throw_error(NO_MODIFICATION_ALLOWED_ERR, 
dom_get_strict_error(intern->document) TSRMLS_CC);
                RETURN_NULL();
@@ -614,12 +624,12 @@
        int uri_len, name_len, ret;
        char *uri, *name;
 
-       DOM_GET_THIS_OBJ(elemp, id, xmlNodePtr, intern);
-
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &uri, &uri_len, 
&name, &name_len) == FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oss", 
&id, dom_element_class_entry, &uri, &uri_len, &name, &name_len) == FAILURE) {
                return;
        }
 
+       DOM_GET_OBJ(elemp, id, xmlNodePtr, intern);
+
        attrp = xmlHasNsProp(elemp, name, uri);
 
        if (attrp == NULL) {
@@ -645,12 +655,12 @@
        dom_object *intern, *attrobj, *oldobj;
        int ret;
 
-       DOM_GET_THIS_OBJ(nodep, id, xmlNodePtr, intern);
-
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &node) == FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", 
&id, dom_element_class_entry, &node, dom_attr_class_entry) == FAILURE) {
                return;
        }
 
+       DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
+
        if (dom_node_is_read_only(nodep) == SUCCESS) {
                php_dom_throw_error(NO_MODIFICATION_ALLOWED_ERR, 
dom_get_strict_error(intern->document) TSRMLS_CC);
                RETURN_FALSE;
@@ -710,14 +720,13 @@
        dom_object *intern, *namednode;
        char *uri, *name;
        xmlChar *local, *nsuri;
-// xmlHashTable *ht;
-
-       DOM_GET_THIS_OBJ(elemp, id, xmlNodePtr, intern);
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &uri, &uri_len, 
&name, &name_len) == FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oss", 
&id, dom_element_class_entry, &uri, &uri_len, &name, &name_len) == FAILURE) {
                return;
        }
 
+       DOM_GET_OBJ(elemp, id, xmlNodePtr, intern);
+
        php_dom_create_interator(return_value, DOM_NODELIST TSRMLS_CC);
        namednode = (dom_object *)zend_objects_get_address(return_value TSRMLS_CC);
        local = xmlCharStrndup(name, name_len);
@@ -740,12 +749,12 @@
        char *name, *value;
        int name_len;
 
-       DOM_GET_THIS_OBJ(nodep, id, xmlNodePtr, intern);
-
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",  &name, &name_len) 
== FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", 
&id, dom_element_class_entry, &name, &name_len) == FAILURE) {
                return;
        }
 
+       DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
+
        value = xmlGetProp(nodep, name);
        if (value == NULL) {
                RETURN_FALSE;
@@ -770,12 +779,12 @@
        int uri_len, name_len;
        char *uri, *name, *value;
 
-       DOM_GET_THIS_OBJ(elemp, id, xmlNodePtr, intern);
-
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &uri, &uri_len, 
&name, &name_len) == FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!s", 
&id, dom_element_class_entry, &uri, &uri_len, &name, &name_len) == FAILURE) {
                return;
        }
 
+       DOM_GET_OBJ(elemp, id, xmlNodePtr, intern);
+
        value = xmlGetNsProp(elemp, name, uri);
 
        if (value != NULL) {

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

Reply via email to