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!
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)
--UEXPECT--
object(tidyNode)#2 (8) {
[u"value"]=>
- string(94) "<html>
+ unicode(94) "<html>
<head>
<title></title>
</head>
</body>
</html>"
[u"name"]=>
- string(0) ""
+ unicode(0) ""
[u"type"]=>
int(0)
[u"line"]=>
[0]=>
&object(tidyNode)#3 (9) {
[u"value"]=>
- string(94) "<html>
+ unicode(94) "<html>
<head>
<title></title>
</head>
</body>
</html>"
[u"name"]=>
- string(4) "html"
+ unicode(4) "html"
[u"type"]=>
int(5)
[u"line"]=>
[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"]=>
[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"]=>
[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"]=>
[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(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"]=>
[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>
</body>
</html>"
[u"name"]=>
- string(4) "html"
+ unicode(4) "html"
[u"type"]=>
int(5)
[u"line"]=>
[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"]=>
[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"]=>
[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"]=>
[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(31) "<head>
+ unicode(31) "<head>
<title></title>
</head>
"
[u"name"]=>
- string(4) "head"
+ unicode(4) "head"
[u"type"]=>
int(5)
[u"line"]=>
[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"]=>
--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
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"]=>
[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"]=>
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"]=>
}
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"]=>
[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"]=>
[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"]=>
[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"]=>
[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"]=>
[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"]=>
[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"]=>
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"]=>
[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"]=>
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"]=>
}
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"]=>
[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"]=>
[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"]=>
[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"]=>
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"]=>
}
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"]=>
[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"]=>
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"]=>
--EXPECT--
string(3) "div"
string(4) "body"
+--UEXPECT--
+unicode(3) "div"
+unicode(4) "body"
</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>"
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)
?>
--EXPECT--
string(0) ""
+--UEXPECT--
+unicode(0) ""
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)) {
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);
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:
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));
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);
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: