summaryrefslogtreecommitdiff
path: root/ext/dom/documenttype.c
diff options
context:
space:
mode:
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 571b17e..2e0323e 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)) {