summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNuno Lopes <nlopess@php.net>2006-09-05 14:55:56 +0000
committerNuno Lopes <nlopess@php.net>2006-09-05 14:55:56 +0000
commitdc8895ed82230e386fdb0f38139c82aa30311c8b (patch)
treec7371beaf97151d48a3ee3332e4d9b6352d3d88f
parentc57bfd9a6606aaa5e53693e0c95cacf07837b316 (diff)
downloadphp-git-dc8895ed82230e386fdb0f38139c82aa30311c8b.tar.gz
finish the cleaning. also add a new test
-rw-r--r--ext/tidy/tests/020.phpt49
-rw-r--r--ext/tidy/tidy.c14
2 files changed, 49 insertions, 14 deletions
diff --git a/ext/tidy/tests/020.phpt b/ext/tidy/tests/020.phpt
new file mode 100644
index 0000000000..e7ee4b3c0c
--- /dev/null
+++ b/ext/tidy/tests/020.phpt
@@ -0,0 +1,49 @@
+--TEST--
+tidy and tidyNode OO
+--SKIPIF--
+<?php if (!extension_loaded('tidy')) echo 'skip'; ?>
+--FILE--
+<?php
+
+//test leaks here:
+new tidyNode();
+var_dump(new tidyNode());
+new tidy();
+var_dump(new tidy());
+
+echo "-------\n";
+
+$x = new tidyNode();
+var_dump($x->isHtml());
+
+$tidy = new tidy();
+$tidy->parseString('<html><?php echo "xpto;" ?></html>');
+
+var_dump(tidy_get_root($tidy)->child[0]->isHtml());
+var_dump(tidy_get_root($tidy)->child[0]->child[0]->isPHP());
+var_dump(tidy_get_root($tidy)->child[0]->child[0]->isAsp());
+var_dump(tidy_get_root($tidy)->child[0]->child[0]->isJste());
+var_dump(tidy_get_root($tidy)->child[0]->child[0]->type === TIDY_NODETYPE_PHP);
+
+var_dump(tidy_get_root($tidy)->child[0]->hasChildren());
+var_dump(tidy_get_root($tidy)->child[0]->child[0]->hasChildren());
+
+?>
+--EXPECT--
+object(tidyNode)#1 (0) {
+}
+object(tidy)#1 (2) {
+ ["errorBuffer"]=>
+ NULL
+ ["value"]=>
+ NULL
+}
+-------
+bool(false)
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+bool(true)
+bool(true)
+bool(false)
diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c
index 4c5bf49f57..4de0bbf347 100644
--- a/ext/tidy/tidy.c
+++ b/ext/tidy/tidy.c
@@ -31,9 +31,6 @@
#include "ext/standard/info.h"
#include "safe_mode.h"
-#include "Zend/zend_exceptions.h"
-#include "Zend/zend_object_handlers.h"
-
#include "tidy.h"
#include "buffio.h"
@@ -276,13 +273,10 @@ static TIDY_DOC_METHOD(__construct);
static TIDY_DOC_METHOD(parseFile);
static TIDY_DOC_METHOD(parseString);
-static TIDY_NODE_METHOD(__construct);
static TIDY_NODE_METHOD(hasChildren);
static TIDY_NODE_METHOD(hasSiblings);
static TIDY_NODE_METHOD(isComment);
static TIDY_NODE_METHOD(isHtml);
-static TIDY_NODE_METHOD(isXhtml);
-static TIDY_NODE_METHOD(isXml);
static TIDY_NODE_METHOD(isText);
static TIDY_NODE_METHOD(isJste);
static TIDY_NODE_METHOD(isAsp);
@@ -353,7 +347,6 @@ static zend_function_entry tidy_funcs_doc[] = {
};
static zend_function_entry tidy_funcs_node[] = {
- TIDY_NODE_ME(__construct, NULL)
TIDY_NODE_ME(hasChildren, NULL)
TIDY_NODE_ME(hasSiblings, NULL)
TIDY_NODE_ME(isComment, NULL)
@@ -1601,13 +1594,6 @@ static PHP_FUNCTION(tidy_get_body)
}
/* }}} */
-/* {{{ proto tidyNode::tidyNode()
- Constructor. */
-static TIDY_NODE_METHOD(__construct)
-{
-}
-/* }}} */
-
/* {{{ proto boolean tidyNode::hasChildren()
Returns true if this node has children */
static TIDY_NODE_METHOD(hasChildren)