nlopess Thu Feb 8 16:37:52 2007 UTC Modified files: /php-src/ext/tidy tidy.c /php-src/ext/tidy/tests 004.phpt 007.phpt 010.phpt 011.phpt 012.phpt 019.phpt 024.phpt 025.phpt 027.phpt Log: fix a few tests (segfaults + wrong output)
http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tidy.c?r1=1.111&r2=1.112&diff_format=u Index: php-src/ext/tidy/tidy.c diff -u php-src/ext/tidy/tidy.c:1.111 php-src/ext/tidy/tidy.c:1.112 --- php-src/ext/tidy/tidy.c:1.111 Tue Jan 23 19:50:14 2007 +++ php-src/ext/tidy/tidy.c Thu Feb 8 16:37:52 2007 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: tidy.c,v 1.111 2007/01/23 19:50:14 nlopess Exp $ */ +/* $Id: tidy.c,v 1.112 2007/02/08 16:37:52 nlopess Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -420,7 +420,7 @@ case TidyString: if (Z_TYPE(conv) != IS_STRING) { zval_copy_ctor(&conv); - convert_to_string(&conv); + convert_to_string_with_converter(&conv, UG(ascii_conv)); } if (tidyOptSetValue(doc, tidyOptGetId(opt), Z_STRVAL(conv))) { if (Z_TYPE(conv) != Z_TYPE_P(value)) { @@ -696,6 +696,7 @@ case IS_UNICODE: obj = (PHPTidyObj *)zend_object_store_get_object(in TSRMLS_CC); + tidyBufInit(&output); tidySaveBuffer (obj->ptdoc->doc, &output); ZVAL_U_STRINGL(obj->converter->conv, out, (char *) output.bp, output.size ? output.size-1 : 0, 1); tidyBufFree(&output); @@ -731,20 +732,23 @@ tidyBufInit(&buf); if (obj->ptdoc) { tidyNodeGetText(obj->ptdoc->doc, obj->node, &buf); - ZVAL_STRINGL(out, (char *) buf.bp, buf.size-1, 0); + ZVAL_STRINGL(out, (char *) buf.bp, buf.size-1, 1); } else { ZVAL_EMPTY_STRING(out); } + tidyBufFree(&buf); break; case IS_UNICODE: obj = (PHPTidyObj *)zend_object_store_get_object(in TSRMLS_CC); + tidyBufInit(&buf); if (obj->ptdoc) { tidyNodeGetText(obj->ptdoc->doc, obj->node, &buf); - ZVAL_U_STRINGL(obj->converter->conv, out, (char *) buf.bp, buf.size-1, 0); + ZVAL_U_STRINGL(obj->converter->conv, out, (char *) buf.bp, buf.size ? buf.size-1 : 0, 1); } else { ZVAL_EMPTY_UNICODE(out); } + tidyBufFree(&buf); break; default: @@ -795,7 +799,7 @@ case is_node: tidyBufInit(&buf); tidyNodeGetText(obj->ptdoc->doc, obj->node, &buf); - ADD_PROPERTY_STRINGL(obj->converter->conv, obj->std.properties, value, buf.bp, buf.size-1); + ADD_PROPERTY_STRINGL(obj->converter->conv, obj->std.properties, value, buf.bp, buf.size ? buf.size-1 : 0); tidyBufFree(&buf); ADD_PROPERTY_ASCII_STRING(obj->std.properties, name, tidyNodeGetName(obj->node)); @@ -847,6 +851,8 @@ newobj->type = is_node; newobj->ptdoc = obj->ptdoc; newobj->ptdoc->ref_count++; + newobj->converter = obj->converter; + if (obj->converter) obj->converter->ref_count++; tidy_add_default_properties(newobj, is_node TSRMLS_CC); add_next_index_zval(children, temp); @@ -906,6 +912,8 @@ newobj->type = is_node; newobj->ptdoc = obj->ptdoc; newobj->ptdoc->ref_count++; + newobj->converter = obj->converter; + if (obj->converter) obj->converter->ref_count++; switch(node) { case is_root_node: @@ -1048,7 +1056,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Tidy support", "enabled"); php_info_print_table_row(2, "libTidy Release", (char *)tidyReleaseDate()); - php_info_print_table_row(2, "Extension Version", PHP_TIDY_MODULE_VERSION " ($Id: tidy.c,v 1.111 2007/01/23 19:50:14 nlopess Exp $)"); + php_info_print_table_row(2, "Extension Version", PHP_TIDY_MODULE_VERSION " ($Id: tidy.c,v 1.112 2007/02/08 16:37:52 nlopess Exp $)"); php_info_print_table_end(); DISPLAY_INI_ENTRIES(); http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tests/004.phpt?r1=1.6&r2=1.7&diff_format=u Index: php-src/ext/tidy/tests/004.phpt diff -u php-src/ext/tidy/tests/004.phpt:1.6 php-src/ext/tidy/tests/004.phpt:1.7 --- php-src/ext/tidy/tests/004.phpt:1.6 Wed May 19 08:45:23 2004 +++ php-src/ext/tidy/tests/004.phpt Thu Feb 8 16:37:52 2007 @@ -9,9 +9,8 @@ echo tidy_get_error_buffer($a); ?> --EXPECT-- - line 1 column 1 - Warning: missing <!DOCTYPE> declaration line 1 column 7 - Warning: discarding unexpected </html> line 1 column 14 - Warning: inserting missing 'title' element Info: Document content looks like HTML 3.2 -3 warnings, 0 errors were found! \ No newline at end of file +3 warnings, 0 errors were found! http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tests/007.phpt?r1=1.11&r2=1.12&diff_format=u Index: php-src/ext/tidy/tests/007.phpt diff -u php-src/ext/tidy/tests/007.phpt:1.11 php-src/ext/tidy/tests/007.phpt:1.12 --- php-src/ext/tidy/tests/007.phpt:1.11 Tue Sep 5 15:25:44 2006 +++ php-src/ext/tidy/tests/007.phpt Thu Feb 8 16:37:52 2007 @@ -36,5 +36,5 @@ Warning: tidy::getOpt(): Unknown Tidy Configuration Option 'bogus-opt' in %s007.php on line 10 bool(false) -Warning: tidy_getopt(): Unknown Tidy Configuration Option 'non-ASCII string àáç' in %s007.php on line 11 +Warning: tidy_getopt(): Binary or ASCII-Unicode string expected, non-ASCII-Unicode string received in %s007.php on line 11 bool(false) http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tests/010.phpt?r1=1.6&r2=1.7&diff_format=u Index: php-src/ext/tidy/tests/010.phpt diff -u php-src/ext/tidy/tests/010.phpt:1.6 php-src/ext/tidy/tests/010.phpt:1.7 --- php-src/ext/tidy/tests/010.phpt:1.6 Sat May 6 11:19:37 2006 +++ php-src/ext/tidy/tests/010.phpt Thu Feb 8 16:37:52 2007 @@ -318,7 +318,7 @@ --UEXPECT-- object(tidyNode)#2 (8) { [u"value"]=> - string(94) "<html> + unicode(94) "<html> <head> <title></title> </head> @@ -326,7 +326,7 @@ </body> </html>" [u"name"]=> - string(0) "" + unicode(0) "" [u"type"]=> int(0) [u"line"]=> @@ -342,7 +342,7 @@ [0]=> &object(tidyNode)#3 (9) { [u"value"]=> - string(94) "<html> + unicode(94) "<html> <head> <title></title> </head> @@ -350,7 +350,7 @@ </body> </html>" [u"name"]=> - string(4) "html" + unicode(4) "html" [u"type"]=> int(5) [u"line"]=> @@ -368,12 +368,12 @@ [0]=> &object(tidyNode)#4 (9) { [u"value"]=> - string(31) "<head> + unicode(31) "<head> <title></title> </head> " [u"name"]=> - string(4) "head" + unicode(4) "head" [u"type"]=> int(5) [u"line"]=> @@ -391,10 +391,10 @@ [0]=> &object(tidyNode)#5 (9) { [u"value"]=> - string(16) "<title></title> + unicode(16) "<title></title> " [u"name"]=> - string(5) "title" + unicode(5) "title" [u"type"]=> int(5) [u"line"]=> @@ -415,11 +415,11 @@ [1]=> &object(tidyNode)#6 (9) { [u"value"]=> - string(49) "<body bgcolor="#FFFFFF" alink="#000000"> + unicode(49) "<body bgcolor="#FFFFFF" alink="#000000"> </body> " [u"name"]=> - string(4) "body" + unicode(4) "body" [u"type"]=> int(5) [u"line"]=> @@ -433,9 +433,9 @@ [u"attribute"]=> array(2) { [u"bgcolor"]=> - string(7) "#FFFFFF" + unicode(7) "#FFFFFF" [u"alink"]=> - string(7) "#000000" + unicode(7) "#000000" } [u"child"]=> NULL @@ -446,11 +446,11 @@ } object(tidyNode)#2 (9) { [u"value"]=> - string(49) "<body bgcolor="#FFFFFF" alink="#000000"> + unicode(49) "<body bgcolor="#FFFFFF" alink="#000000"> </body> " [u"name"]=> - string(4) "body" + unicode(4) "body" [u"type"]=> int(5) [u"line"]=> @@ -464,16 +464,16 @@ [u"attribute"]=> array(2) { [u"bgcolor"]=> - string(7) "#FFFFFF" + unicode(7) "#FFFFFF" [u"alink"]=> - string(7) "#000000" + unicode(7) "#000000" } [u"child"]=> NULL } object(tidyNode)#2 (9) { [u"value"]=> - string(94) "<html> + unicode(94) "<html> <head> <title></title> </head> @@ -481,7 +481,7 @@ </body> </html>" [u"name"]=> - string(4) "html" + unicode(4) "html" [u"type"]=> int(5) [u"line"]=> @@ -499,12 +499,12 @@ [0]=> &object(tidyNode)#3 (9) { [u"value"]=> - string(31) "<head> + unicode(31) "<head> <title></title> </head> " [u"name"]=> - string(4) "head" + unicode(4) "head" [u"type"]=> int(5) [u"line"]=> @@ -522,10 +522,10 @@ [0]=> &object(tidyNode)#6 (9) { [u"value"]=> - string(16) "<title></title> + unicode(16) "<title></title> " [u"name"]=> - string(5) "title" + unicode(5) "title" [u"type"]=> int(5) [u"line"]=> @@ -546,11 +546,11 @@ [1]=> &object(tidyNode)#4 (9) { [u"value"]=> - string(49) "<body bgcolor="#FFFFFF" alink="#000000"> + unicode(49) "<body bgcolor="#FFFFFF" alink="#000000"> </body> " [u"name"]=> - string(4) "body" + unicode(4) "body" [u"type"]=> int(5) [u"line"]=> @@ -564,9 +564,9 @@ [u"attribute"]=> array(2) { [u"bgcolor"]=> - string(7) "#FFFFFF" + unicode(7) "#FFFFFF" [u"alink"]=> - string(7) "#000000" + unicode(7) "#000000" } [u"child"]=> NULL @@ -575,12 +575,12 @@ } object(tidyNode)#2 (9) { [u"value"]=> - string(31) "<head> + unicode(31) "<head> <title></title> </head> " [u"name"]=> - string(4) "head" + unicode(4) "head" [u"type"]=> int(5) [u"line"]=> @@ -598,10 +598,10 @@ [0]=> &object(tidyNode)#4 (9) { [u"value"]=> - string(16) "<title></title> + unicode(16) "<title></title> " [u"name"]=> - string(5) "title" + unicode(5) "title" [u"type"]=> int(5) [u"line"]=> http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tests/011.phpt?r1=1.4&r2=1.5&diff_format=u Index: php-src/ext/tidy/tests/011.phpt diff -u php-src/ext/tidy/tests/011.phpt:1.4 php-src/ext/tidy/tests/011.phpt:1.5 --- php-src/ext/tidy/tests/011.phpt:1.4 Sat May 6 11:19:37 2006 +++ php-src/ext/tidy/tests/011.phpt Thu Feb 8 16:37:52 2007 @@ -23,9 +23,9 @@ --UEXPECT-- array(2) { [u"bgcolor"]=> - string(7) "#FFFFFF" + unicode(7) "#FFFFFF" [u"alink"]=> - string(7) "#000000" + unicode(7) "#000000" } Attrib 'bgcolor': #FFFFFF Attrib 'alink': #000000 http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tests/012.phpt?r1=1.7&r2=1.8&diff_format=u Index: php-src/ext/tidy/tests/012.phpt diff -u php-src/ext/tidy/tests/012.phpt:1.7 php-src/ext/tidy/tests/012.phpt:1.8 --- php-src/ext/tidy/tests/012.phpt:1.7 Sat May 6 11:19:37 2006 +++ php-src/ext/tidy/tests/012.phpt Thu Feb 8 16:37:52 2007 @@ -475,12 +475,12 @@ bool(true) object(tidyNode)#3 (9) { [u"value"]=> - string(31) "<head> + unicode(31) "<head> <title></title> </head> " [u"name"]=> - string(4) "head" + unicode(4) "head" [u"type"]=> int(5) [u"line"]=> @@ -498,10 +498,10 @@ [0]=> &object(tidyNode)#4 (9) { [u"value"]=> - string(16) "<title></title> + unicode(16) "<title></title> " [u"name"]=> - string(5) "title" + unicode(5) "title" [u"type"]=> int(5) [u"line"]=> @@ -522,10 +522,10 @@ bool(true) object(tidyNode)#4 (9) { [u"value"]=> - string(16) "<title></title> + unicode(16) "<title></title> " [u"name"]=> - string(5) "title" + unicode(5) "title" [u"type"]=> int(5) [u"line"]=> @@ -543,12 +543,12 @@ } object(tidyNode)#5 (9) { [u"value"]=> - string(80) "<body bgcolor="#FFFFFF" alink="#000000"> + unicode(80) "<body bgcolor="#FFFFFF" alink="#000000"> <b>Hi</b><i>Bye<u>Test</u></i> </body> " [u"name"]=> - string(4) "body" + unicode(4) "body" [u"type"]=> int(5) [u"line"]=> @@ -562,18 +562,18 @@ [u"attribute"]=> array(2) { [u"bgcolor"]=> - string(7) "#FFFFFF" + unicode(7) "#FFFFFF" [u"alink"]=> - string(7) "#000000" + unicode(7) "#000000" } [u"child"]=> array(2) { [0]=> &object(tidyNode)#6 (9) { [u"value"]=> - string(9) "<b>Hi</b>" + unicode(9) "<b>Hi</b>" [u"name"]=> - string(1) "b" + unicode(1) "b" [u"type"]=> int(5) [u"line"]=> @@ -591,9 +591,9 @@ [0]=> &object(tidyNode)#7 (8) { [u"value"]=> - string(2) "Hi" + unicode(2) "Hi" [u"name"]=> - string(0) "" + unicode(0) "" [u"type"]=> int(4) [u"line"]=> @@ -612,9 +612,9 @@ [1]=> &object(tidyNode)#8 (9) { [u"value"]=> - string(21) "<i>Bye<u>Test</u></i>" + unicode(21) "<i>Bye<u>Test</u></i>" [u"name"]=> - string(1) "i" + unicode(1) "i" [u"type"]=> int(5) [u"line"]=> @@ -632,9 +632,9 @@ [0]=> &object(tidyNode)#9 (8) { [u"value"]=> - string(3) "Bye" + unicode(3) "Bye" [u"name"]=> - string(0) "" + unicode(0) "" [u"type"]=> int(4) [u"line"]=> @@ -651,9 +651,9 @@ [1]=> &object(tidyNode)#10 (9) { [u"value"]=> - string(11) "<u>Test</u>" + unicode(11) "<u>Test</u>" [u"name"]=> - string(1) "u" + unicode(1) "u" [u"type"]=> int(5) [u"line"]=> @@ -671,9 +671,9 @@ [0]=> &object(tidyNode)#11 (8) { [u"value"]=> - string(4) "Test" + unicode(4) "Test" [u"name"]=> - string(0) "" + unicode(0) "" [u"type"]=> int(4) [u"line"]=> @@ -696,9 +696,9 @@ bool(true) object(tidyNode)#6 (9) { [u"value"]=> - string(9) "<b>Hi</b>" + unicode(9) "<b>Hi</b>" [u"name"]=> - string(1) "b" + unicode(1) "b" [u"type"]=> int(5) [u"line"]=> @@ -716,9 +716,9 @@ [0]=> &object(tidyNode)#7 (8) { [u"value"]=> - string(2) "Hi" + unicode(2) "Hi" [u"name"]=> - string(0) "" + unicode(0) "" [u"type"]=> int(4) [u"line"]=> @@ -737,9 +737,9 @@ bool(true) object(tidyNode)#7 (8) { [u"value"]=> - string(2) "Hi" + unicode(2) "Hi" [u"name"]=> - string(0) "" + unicode(0) "" [u"type"]=> int(4) [u"line"]=> @@ -755,9 +755,9 @@ } object(tidyNode)#8 (9) { [u"value"]=> - string(21) "<i>Bye<u>Test</u></i>" + unicode(21) "<i>Bye<u>Test</u></i>" [u"name"]=> - string(1) "i" + unicode(1) "i" [u"type"]=> int(5) [u"line"]=> @@ -775,9 +775,9 @@ [0]=> &object(tidyNode)#9 (8) { [u"value"]=> - string(3) "Bye" + unicode(3) "Bye" [u"name"]=> - string(0) "" + unicode(0) "" [u"type"]=> int(4) [u"line"]=> @@ -794,9 +794,9 @@ [1]=> &object(tidyNode)#10 (9) { [u"value"]=> - string(11) "<u>Test</u>" + unicode(11) "<u>Test</u>" [u"name"]=> - string(1) "u" + unicode(1) "u" [u"type"]=> int(5) [u"line"]=> @@ -814,9 +814,9 @@ [0]=> &object(tidyNode)#11 (8) { [u"value"]=> - string(4) "Test" + unicode(4) "Test" [u"name"]=> - string(0) "" + unicode(0) "" [u"type"]=> int(4) [u"line"]=> @@ -837,9 +837,9 @@ bool(true) object(tidyNode)#9 (8) { [u"value"]=> - string(3) "Bye" + unicode(3) "Bye" [u"name"]=> - string(0) "" + unicode(0) "" [u"type"]=> int(4) [u"line"]=> @@ -855,9 +855,9 @@ } object(tidyNode)#10 (9) { [u"value"]=> - string(11) "<u>Test</u>" + unicode(11) "<u>Test</u>" [u"name"]=> - string(1) "u" + unicode(1) "u" [u"type"]=> int(5) [u"line"]=> @@ -875,9 +875,9 @@ [0]=> &object(tidyNode)#11 (8) { [u"value"]=> - string(4) "Test" + unicode(4) "Test" [u"name"]=> - string(0) "" + unicode(0) "" [u"type"]=> int(4) [u"line"]=> @@ -896,9 +896,9 @@ bool(true) object(tidyNode)#11 (8) { [u"value"]=> - string(4) "Test" + unicode(4) "Test" [u"name"]=> - string(0) "" + unicode(0) "" [u"type"]=> int(4) [u"line"]=> http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tests/019.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/tidy/tests/019.phpt diff -u php-src/ext/tidy/tests/019.phpt:1.1 php-src/ext/tidy/tests/019.phpt:1.2 --- php-src/ext/tidy/tests/019.phpt:1.1 Sat Apr 29 12:16:21 2006 +++ php-src/ext/tidy/tests/019.phpt Thu Feb 8 16:37:52 2007 @@ -11,3 +11,6 @@ --EXPECT-- string(3) "div" string(4) "body" +--UEXPECT-- +unicode(3) "div" +unicode(4) "body" http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tests/024.phpt?r1=1.2&r2=1.3&diff_format=u Index: php-src/ext/tidy/tests/024.phpt diff -u php-src/ext/tidy/tests/024.phpt:1.2 php-src/ext/tidy/tests/024.phpt:1.3 --- php-src/ext/tidy/tests/024.phpt:1.2 Sat Jan 20 12:58:20 2007 +++ php-src/ext/tidy/tests/024.phpt Thu Feb 8 16:37:52 2007 @@ -39,3 +39,15 @@ </wps:block> </body> </html>" +--UEXPECT-- +unicode(117) "<html> +<head> +<title></title> +</head> +<body> +<wps:block> +<wps:var> +<wps:value></wps:var> +</wps:block> +</body> +</html>" http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tests/025.phpt?r1=1.2&r2=1.3&diff_format=u Index: php-src/ext/tidy/tests/025.phpt diff -u php-src/ext/tidy/tests/025.phpt:1.2 php-src/ext/tidy/tests/025.phpt:1.3 --- php-src/ext/tidy/tests/025.phpt:1.2 Sat Jan 20 12:58:20 2007 +++ php-src/ext/tidy/tests/025.phpt Thu Feb 8 16:37:52 2007 @@ -48,3 +48,18 @@ float(0) int(0) bool(true) +--UEXPECT-- +bool(false) +bool(false) +bool(false) +bool(false) +unicode(0) "" +bool(true) +bool(true) +bool(true) +bool(true) +unicode(16) "<!-- comment -->" +bool(true) +float(0) +int(0) +bool(true) http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tests/027.phpt?r1=1.2&r2=1.3&diff_format=u Index: php-src/ext/tidy/tests/027.phpt diff -u php-src/ext/tidy/tests/027.phpt:1.2 php-src/ext/tidy/tests/027.phpt:1.3 --- php-src/ext/tidy/tests/027.phpt:1.2 Tue Jan 23 19:50:14 2007 +++ php-src/ext/tidy/tests/027.phpt Thu Feb 8 16:37:52 2007 @@ -57,3 +57,5 @@ ?> --EXPECT-- string(0) "" +--UEXPECT-- +unicode(0) ""
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php