mirror of
https://github.com/php/php-src.git
synced 2024-11-26 11:23:47 +08:00
issue warning if object is in invalid state when dealing with properties
This commit is contained in:
parent
5dcf37b618
commit
602c786aa9
@ -92,6 +92,12 @@ int dom_attr_name_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
xmlAttrPtr attrp;
|
||||
|
||||
attrp = (xmlAttrPtr) dom_object_get_node(obj);
|
||||
|
||||
if (attrp == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
ALLOC_ZVAL(*retval);
|
||||
ZVAL_STRING(*retval, (char *) (attrp->name), 1);
|
||||
|
||||
@ -131,6 +137,11 @@ int dom_attr_value_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
attrp = (xmlAttrPtr) dom_object_get_node(obj);
|
||||
|
||||
if (attrp == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
ALLOC_ZVAL(*retval);
|
||||
|
||||
|
||||
@ -152,6 +163,11 @@ int dom_attr_value_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
|
||||
attrp = (xmlAttrPtr) dom_object_get_node(obj);
|
||||
|
||||
if (attrp == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (attrp->children) {
|
||||
node_list_unlink(attrp->children TSRMLS_CC);
|
||||
}
|
||||
@ -190,6 +206,11 @@ int dom_attr_owner_element_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
nodep = dom_object_get_node(obj);
|
||||
|
||||
if (nodep == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
nodeparent = nodep->parent;
|
||||
if (!nodeparent) {
|
||||
return FAILURE;
|
||||
|
@ -56,6 +56,11 @@ int dom_characterdata_data_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
nodep = dom_object_get_node(obj);
|
||||
|
||||
if (nodep == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
ALLOC_ZVAL(*retval);
|
||||
|
||||
if ((content = xmlNodeGetContent(nodep)) != NULL) {
|
||||
@ -75,6 +80,11 @@ int dom_characterdata_data_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
|
||||
nodep = dom_object_get_node(obj);
|
||||
|
||||
if (nodep == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (newval->type != IS_STRING) {
|
||||
if(newval->refcount > 1) {
|
||||
value_copy = *newval;
|
||||
@ -108,6 +118,11 @@ int dom_characterdata_length_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
nodep = dom_object_get_node(obj);
|
||||
|
||||
if (nodep == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
ALLOC_ZVAL(*retval);
|
||||
|
||||
content = xmlNodeGetContent(nodep);
|
||||
|
@ -101,6 +101,11 @@ int dom_document_doctype_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
docp = (xmlDocPtr) dom_object_get_node(obj);
|
||||
|
||||
if (docp == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
dtdptr = xmlGetIntSubset(docp);
|
||||
if (!dtdptr) {
|
||||
return FAILURE;
|
||||
@ -148,6 +153,11 @@ int dom_document_document_element_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
docp = (xmlDocPtr) dom_object_get_node(obj);
|
||||
|
||||
if (docp == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
root = xmlDocGetRootElement(docp);
|
||||
if (!root) {
|
||||
return FAILURE;
|
||||
@ -195,6 +205,12 @@ int dom_document_encoding_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
char *encoding;
|
||||
|
||||
docp = (xmlDocPtr) dom_object_get_node(obj);
|
||||
|
||||
if (docp == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
encoding = (char *) docp->encoding;
|
||||
ALLOC_ZVAL(*retval);
|
||||
|
||||
@ -215,6 +231,11 @@ int dom_document_encoding_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
|
||||
docp = (xmlDocPtr) dom_object_get_node(obj);
|
||||
|
||||
if (docp == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (newval->type != IS_STRING) {
|
||||
if(newval->refcount > 1) {
|
||||
value_copy = *newval;
|
||||
@ -258,6 +279,12 @@ int dom_document_standalone_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
int standalone;
|
||||
|
||||
docp = (xmlDocPtr) dom_object_get_node(obj);
|
||||
|
||||
if (docp == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
ALLOC_ZVAL(*retval);
|
||||
standalone = docp->standalone;
|
||||
ZVAL_BOOL(*retval, standalone);
|
||||
@ -273,6 +300,11 @@ int dom_document_standalone_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
|
||||
docp = (xmlDocPtr) dom_object_get_node(obj);
|
||||
|
||||
if (docp == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if(newval->refcount > 1) {
|
||||
value_copy = *newval;
|
||||
zval_copy_ctor(&value_copy);
|
||||
@ -313,6 +345,12 @@ int dom_document_version_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
char *version;
|
||||
|
||||
docp = (xmlDocPtr) dom_object_get_node(obj);
|
||||
|
||||
if (docp == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
version = (char *) docp->version;
|
||||
ALLOC_ZVAL(*retval);
|
||||
|
||||
@ -331,6 +369,12 @@ int dom_document_version_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
xmlDoc *docp;
|
||||
|
||||
docp = (xmlDocPtr) dom_object_get_node(obj);
|
||||
|
||||
if (docp == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (docp->version != NULL) {
|
||||
xmlFree((xmlChar *) docp->version );
|
||||
}
|
||||
@ -626,6 +670,11 @@ int dom_document_document_uri_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
docp = (xmlDocPtr) dom_object_get_node(obj);
|
||||
|
||||
if (docp == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
ALLOC_ZVAL(*retval);
|
||||
url = (char *) docp->URL;
|
||||
if (url != NULL) {
|
||||
@ -643,6 +692,12 @@ int dom_document_document_uri_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
xmlDoc *docp;
|
||||
|
||||
docp = (xmlDocPtr) dom_object_get_node(obj);
|
||||
|
||||
if (docp == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (docp->URL != NULL) {
|
||||
xmlFree((xmlChar *) docp->URL);
|
||||
}
|
||||
@ -1025,8 +1080,6 @@ PHP_FUNCTION(dom_document_create_element_ns)
|
||||
|
||||
DOM_GET_OBJ(docp, id, xmlDocPtr, intern);
|
||||
|
||||
DOM_GET_THIS_OBJ(docp, id, xmlDocPtr, intern);
|
||||
|
||||
errorcode = dom_check_qname(name, &localname, &prefix, uri_len, name_len);
|
||||
|
||||
if (errorcode == 0) {
|
||||
|
@ -50,6 +50,12 @@ int dom_documenttype_name_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
xmlDtdPtr dtdptr;
|
||||
|
||||
dtdptr = (xmlDtdPtr) dom_object_get_node(obj);
|
||||
|
||||
if (dtdptr == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
ALLOC_ZVAL(*retval);
|
||||
ZVAL_STRING(*retval, (char *) (dtdptr->name), 1);
|
||||
|
||||
@ -73,6 +79,11 @@ int dom_documenttype_entities_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
doctypep = (xmlDtdPtr) dom_object_get_node(obj);
|
||||
|
||||
if (doctypep == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
MAKE_STD_ZVAL(*retval);
|
||||
php_dom_create_interator(*retval, DOM_NAMEDNODEMAP TSRMLS_CC);
|
||||
|
||||
@ -101,6 +112,11 @@ int dom_documenttype_notations_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
doctypep = (xmlDtdPtr) dom_object_get_node(obj);
|
||||
|
||||
if (doctypep == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
MAKE_STD_ZVAL(*retval);
|
||||
php_dom_create_interator(*retval, DOM_NAMEDNODEMAP TSRMLS_CC);
|
||||
|
||||
@ -127,6 +143,11 @@ int dom_documenttype_public_id_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
dtdptr = (xmlDtdPtr) dom_object_get_node(obj);
|
||||
|
||||
if (dtdptr == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
ALLOC_ZVAL(*retval);
|
||||
if (dtdptr->ExternalID) {
|
||||
ZVAL_STRING(*retval, (char *) (dtdptr->ExternalID), 1);
|
||||
@ -152,6 +173,11 @@ int dom_documenttype_system_id_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
dtdptr = (xmlDtdPtr) dom_object_get_node(obj);
|
||||
|
||||
if (dtdptr == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
ALLOC_ZVAL(*retval);
|
||||
if (dtdptr->SystemID) {
|
||||
ZVAL_STRING(*retval, (char *) (dtdptr->SystemID), 1);
|
||||
@ -180,6 +206,11 @@ int dom_documenttype_internal_subset_read(dom_object *obj, zval **retval TSRMLS_
|
||||
|
||||
dtdptr = (xmlDtdPtr) dom_object_get_node(obj);
|
||||
|
||||
if (dtdptr == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
ALLOC_ZVAL(*retval);
|
||||
|
||||
if (dtdptr->doc != NULL && ((intsubset = dtdptr->doc->intSubset) != NULL)) {
|
||||
|
@ -109,6 +109,12 @@ int dom_element_tag_name_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
xmlChar *qname;
|
||||
|
||||
nodep = dom_object_get_node(obj);
|
||||
|
||||
if (nodep == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
ALLOC_ZVAL(*retval);
|
||||
ns = nodep->ns;
|
||||
if (ns != NULL && ns->prefix) {
|
||||
|
@ -52,6 +52,11 @@ int dom_entity_public_id_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
nodep = (xmlEntity *) dom_object_get_node(obj);
|
||||
|
||||
if (nodep == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
ALLOC_ZVAL(*retval);
|
||||
if (nodep->etype != XML_EXTERNAL_GENERAL_UNPARSED_ENTITY) {
|
||||
ZVAL_NULL(*retval);
|
||||
@ -77,6 +82,11 @@ int dom_entity_system_id_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
nodep = (xmlEntity *) dom_object_get_node(obj);
|
||||
|
||||
if (nodep == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
ALLOC_ZVAL(*retval);
|
||||
if (nodep->etype != XML_EXTERNAL_GENERAL_UNPARSED_ENTITY) {
|
||||
ZVAL_NULL(*retval);
|
||||
@ -103,6 +113,11 @@ int dom_entity_notation_name_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
nodep = (xmlEntity *) dom_object_get_node(obj);
|
||||
|
||||
if (nodep == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
ALLOC_ZVAL(*retval);
|
||||
if (nodep->etype != XML_EXTERNAL_GENERAL_UNPARSED_ENTITY) {
|
||||
ZVAL_NULL(*retval);
|
||||
|
@ -86,6 +86,11 @@ int dom_node_node_name_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
nodep = dom_object_get_node(obj);
|
||||
|
||||
if (nodep == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
switch (nodep->type) {
|
||||
case XML_ATTRIBUTE_NODE:
|
||||
case XML_ELEMENT_NODE:
|
||||
@ -170,6 +175,12 @@ int dom_node_node_value_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
char *str = NULL;
|
||||
|
||||
nodep = dom_object_get_node(obj);
|
||||
|
||||
if (nodep == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
/* Access to Element node is implemented as a convience method */
|
||||
switch (nodep->type) {
|
||||
case XML_ATTRIBUTE_NODE:
|
||||
@ -209,6 +220,11 @@ int dom_node_node_value_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
|
||||
nodep = dom_object_get_node(obj);
|
||||
|
||||
if (nodep == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
/* Access to Element node is implemented as a convience method */
|
||||
switch (nodep->type) {
|
||||
case XML_ELEMENT_NODE:
|
||||
@ -255,6 +271,11 @@ int dom_node_node_type_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
nodep = dom_object_get_node(obj);
|
||||
|
||||
if (nodep == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
ALLOC_ZVAL(*retval);
|
||||
|
||||
/* Specs dictate that they are both type XML_DOCUMENT_TYPE_NODE */
|
||||
@ -283,6 +304,11 @@ int dom_node_parent_node_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
nodep = dom_object_get_node(obj);
|
||||
|
||||
if (nodep == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
nodeparent = nodep->parent;
|
||||
if (!nodeparent) {
|
||||
return FAILURE;
|
||||
@ -313,6 +339,11 @@ int dom_node_child_nodes_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
nodep = dom_object_get_node(obj);
|
||||
|
||||
if (nodep == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
ALLOC_ZVAL(*retval);
|
||||
|
||||
if (dom_node_children_valid(nodep) == FAILURE) {
|
||||
@ -342,6 +373,11 @@ int dom_node_first_child_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
nodep = dom_object_get_node(obj);
|
||||
|
||||
if (nodep == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (dom_node_children_valid(nodep) == SUCCESS) {
|
||||
first = nodep->children;
|
||||
}
|
||||
@ -375,6 +411,11 @@ int dom_node_last_child_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
nodep = dom_object_get_node(obj);
|
||||
|
||||
if (nodep == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (dom_node_children_valid(nodep) == SUCCESS) {
|
||||
last = nodep->last;
|
||||
}
|
||||
@ -408,6 +449,11 @@ int dom_node_previous_sibling_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
nodep = dom_object_get_node(obj);
|
||||
|
||||
if (nodep == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
prevsib = nodep->prev;
|
||||
if (!prevsib) {
|
||||
return FAILURE;
|
||||
@ -438,6 +484,11 @@ int dom_node_next_sibling_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
nodep = dom_object_get_node(obj);
|
||||
|
||||
if (nodep == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
nextsib = nodep->next;
|
||||
if (!nextsib) {
|
||||
return FAILURE;
|
||||
@ -468,6 +519,11 @@ int dom_node_attributes_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
nodep = dom_object_get_node(obj);
|
||||
|
||||
if (nodep == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
ALLOC_ZVAL(*retval);
|
||||
|
||||
if (nodep->type == XML_ELEMENT_NODE) {
|
||||
@ -498,6 +554,11 @@ int dom_node_owner_document_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
nodep = dom_object_get_node(obj);
|
||||
|
||||
if (nodep == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (nodep->type == XML_DOCUMENT_NODE || nodep->type == XML_HTML_DOCUMENT_NODE) {
|
||||
ALLOC_ZVAL(*retval);
|
||||
ZVAL_NULL(*retval);
|
||||
@ -534,6 +595,11 @@ int dom_node_namespace_uri_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
nodep = dom_object_get_node(obj);
|
||||
|
||||
if (nodep == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
switch (nodep->type) {
|
||||
case XML_ELEMENT_NODE:
|
||||
case XML_ATTRIBUTE_NODE:
|
||||
@ -575,6 +641,11 @@ int dom_node_prefix_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
nodep = dom_object_get_node(obj);
|
||||
|
||||
if (nodep == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
switch (nodep->type) {
|
||||
case XML_ELEMENT_NODE:
|
||||
case XML_ATTRIBUTE_NODE:
|
||||
@ -611,6 +682,11 @@ int dom_node_prefix_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
|
||||
nodep = dom_object_get_node(obj);
|
||||
|
||||
if (nodep == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
switch (nodep->type) {
|
||||
case XML_ELEMENT_NODE:
|
||||
case XML_ATTRIBUTE_NODE:
|
||||
@ -682,6 +758,11 @@ int dom_node_local_name_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
nodep = dom_object_get_node(obj);
|
||||
|
||||
if (nodep == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
ALLOC_ZVAL(*retval);
|
||||
|
||||
if (nodep->type == XML_ELEMENT_NODE || nodep->type == XML_ATTRIBUTE_NODE || nodep->type == XML_NAMESPACE_DECL) {
|
||||
@ -709,6 +790,11 @@ int dom_node_base_uri_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
nodep = dom_object_get_node(obj);
|
||||
|
||||
if (nodep == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
ALLOC_ZVAL(*retval);
|
||||
|
||||
baseuri = xmlNodeGetBase(nodep->doc, nodep);
|
||||
@ -738,6 +824,11 @@ int dom_node_text_content_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
nodep = dom_object_get_node(obj);
|
||||
|
||||
if (nodep == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
str = xmlNodeGetContent(nodep);
|
||||
|
||||
ALLOC_ZVAL(*retval);
|
||||
|
@ -51,6 +51,12 @@ int dom_notation_public_id_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
xmlNotationPtr nodep;
|
||||
|
||||
nodep = (xmlNotationPtr) dom_object_get_node(obj);
|
||||
|
||||
if (nodep == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
ALLOC_ZVAL(*retval);
|
||||
if (nodep->PublicID) {
|
||||
ZVAL_STRING(*retval, (char *) (nodep->PublicID), 1);
|
||||
@ -75,6 +81,12 @@ int dom_notation_system_id_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
xmlNotationPtr nodep;
|
||||
|
||||
nodep = (xmlNotationPtr) dom_object_get_node(obj);
|
||||
|
||||
if (nodep == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
ALLOC_ZVAL(*retval);
|
||||
if (nodep->SystemID) {
|
||||
ZVAL_STRING(*retval, (char *) (nodep->PublicID), 1);
|
||||
|
@ -86,6 +86,11 @@ int dom_processinginstruction_target_read(dom_object *obj, zval **retval TSRMLS_
|
||||
|
||||
nodep = dom_object_get_node(obj);
|
||||
|
||||
if (nodep == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
ALLOC_ZVAL(*retval);
|
||||
ZVAL_STRING(*retval, (char *) (nodep->name), 1);
|
||||
|
||||
@ -108,6 +113,11 @@ int dom_processinginstruction_data_read(dom_object *obj, zval **retval TSRMLS_DC
|
||||
|
||||
nodep = dom_object_get_node(obj);
|
||||
|
||||
if (nodep == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
ALLOC_ZVAL(*retval);
|
||||
|
||||
|
||||
@ -128,6 +138,11 @@ int dom_processinginstruction_data_write(dom_object *obj, zval *newval TSRMLS_DC
|
||||
|
||||
nodep = dom_object_get_node(obj);
|
||||
|
||||
if (nodep == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (newval->type != IS_STRING) {
|
||||
if(newval->refcount > 1) {
|
||||
value_copy = *newval;
|
||||
|
@ -85,6 +85,11 @@ int dom_text_whole_text_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
node = dom_object_get_node(obj);
|
||||
|
||||
if (node == NULL) {
|
||||
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
ALLOC_ZVAL(*retval);
|
||||
wholetext = xmlNodeListGetString(node->doc, node, 1);
|
||||
ZVAL_STRING(*retval, wholetext, 1);
|
||||
|
Loading…
Reference in New Issue
Block a user