]> granicus.if.org Git - php/commitdiff
Fix Bug, if parser input is not a filename (By Adam)
authorChristian Stocker <chregu@php.net>
Mon, 1 Dec 2003 08:18:35 +0000 (08:18 +0000)
committerChristian Stocker <chregu@php.net>
Mon, 1 Dec 2003 08:18:35 +0000 (08:18 +0000)
ext/dom/document.c

index 034b83f3992e7bd370ac46e6907cceed5672127e..59a0aa5ce03f52bdee5de007554592bf68cdc40e 100644 (file)
@@ -123,8 +123,14 @@ static void php_dom_ctx_error_level(int level, void *ctx, const char *msg)
        TSRMLS_FETCH();
 
        parser = (xmlParserCtxtPtr) ctx;
-       php_error_docref(NULL TSRMLS_CC, level, "%s in %s, line: %d", msg, parser->input->filename, parser->input->line);
 
+       if (parser != NULL && parser->input != NULL) {
+               if (parser->input->filename) {
+                       php_error_docref(NULL TSRMLS_CC, level, "%s in %s, line: %d", msg, parser->input->filename, parser->input->line);
+               } else {
+                       php_error_docref(NULL TSRMLS_CC, level, "%s in Entity, line: %d", msg, parser->input->line);
+               }
+       }
 }
 /* }}} end php_dom_ctx_error */