From 8a36e954f09be109346628c3bd364e935951a5ce Mon Sep 17 00:00:00 2001 From: John Coggeshall Date: Mon, 3 Nov 2003 16:35:58 +0000 Subject: [PATCH] Fixed a bug -- Nodes of certain types don't actually have ID values and PHP would segv trying to read one. --- ext/tidy/tidy.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c index 07143462236..8f41a1aaeb7 100644 --- a/ext/tidy/tidy.c +++ b/ext/tidy/tidy.c @@ -985,9 +985,16 @@ static void tidy_add_default_properities(PHPTidyObj *obj, tidy_obj_type type TSR ADD_PROPERITY_STRING(obj->std.properties, value, buf.bp); tidyBufFree(&buf); + fprintf(stderr, "type: %d\n",tidyNodeGetType(obj->node)); ADD_PROPERITY_STRING(obj->std.properties, name, tidyNodeGetName(obj->node)); ADD_PROPERITY_LONG(obj->std.properties, type, tidyNodeGetType(obj->node)); - ADD_PROPERITY_LONG(obj->std.properties, id, tidyNodeGetId(obj->node)); + switch(tidyNodeGetType(obj->node)) { + case TidyNode_Text: + case TidyNode_Comment: + break; + default: + ADD_PROPERITY_LONG(obj->std.properties, id, tidyNodeGetId(obj->node)); + } break; case is_attr: