summaryrefslogtreecommitdiff
path: root/ext/dom/documenttype.c
diff options
context:
space:
mode:
authorRob Richards <rrichards@php.net>2004-02-16 13:06:33 +0000
committerRob Richards <rrichards@php.net>2004-02-16 13:06:33 +0000
commit602c786aa9bd025c5cf37326c770a959cba57936 (patch)
treec9f9a9434c12d5f93680484f94107c5cb9399116 /ext/dom/documenttype.c
parent5dcf37b6188b8dcec92720f0a41151622a8dd7b9 (diff)
downloadphp-git-602c786aa9bd025c5cf37326c770a959cba57936.tar.gz
issue warning if object is in invalid state when dealing with properties
Diffstat (limited to 'ext/dom/documenttype.c')
-rw-r--r--ext/dom/documenttype.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/ext/dom/documenttype.c b/ext/dom/documenttype.c
index 571b17e3d8..2e0323e810 100644
--- a/ext/dom/documenttype.c
+++ b/ext/dom/documenttype.c
@@ -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)) {