From: Pierrick Charron Date: Fri, 25 Dec 2009 21:24:36 +0000 (+0000) Subject: Changed tidyNode class to disallow manual node creation. X-Git-Tag: php-5.4.0alpha1~191^2~2161 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ae727fea244fae165ad819bb878124d3e3a532b5;p=php Changed tidyNode class to disallow manual node creation. --- diff --git a/ext/tidy/tests/023.phpt b/ext/tidy/tests/023.phpt index fd299f9cfe..cc2ed99877 100644 --- a/ext/tidy/tests/023.phpt +++ b/ext/tidy/tests/023.phpt @@ -6,16 +6,11 @@ tidy and tidyNode OO isHtml()); - $tidy = new tidy(); $tidy->parseString(''); @@ -30,8 +25,6 @@ var_dump(tidy_get_root($tidy)->child[0]->child[0]->hasChildren()); ?> --EXPECT-- -object(tidyNode)#1 (0) { -} object(tidy)#1 (2) { [u"errorBuffer"]=> NULL @@ -39,7 +32,6 @@ object(tidy)#1 (2) { NULL } ------- -bool(false) bool(true) bool(true) bool(false) diff --git a/ext/tidy/tests/025.phpt b/ext/tidy/tests/025.phpt index 66e47e4a87..b1c735e24b 100644 --- a/ext/tidy/tests/025.phpt +++ b/ext/tidy/tests/025.phpt @@ -5,15 +5,6 @@ tidyNode tests --FILE-- isPhp()); -var_dump($node->isText()); -var_dump($node->isComment()); -var_dump($node->hasSiblings()); -var_dump((string)$node); - $tidy=tidy_parse_string('<% %>'); var_dump($tidy->Root()->child[0]->isAsp()); @@ -34,11 +25,6 @@ var_dump($tidy->Root()->child[0]->child[0]->hasSiblings()); ?> --EXPECT-- -bool(false) -bool(false) -bool(false) -bool(false) -unicode(0) "" bool(true) bool(true) bool(true) diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c index 371474e419..7628bd892e 100644 --- a/ext/tidy/tidy.c +++ b/ext/tidy/tidy.c @@ -275,6 +275,7 @@ static TIDY_NODE_METHOD(isJste); static TIDY_NODE_METHOD(isAsp); static TIDY_NODE_METHOD(isPhp); static TIDY_NODE_METHOD(getParent); +static TIDY_NODE_METHOD(__construct); /* }}} */ ZEND_DECLARE_MODULE_GLOBALS(tidy) @@ -443,6 +444,7 @@ static const zend_function_entry tidy_funcs_node[] = { TIDY_NODE_ME(isAsp, NULL) TIDY_NODE_ME(isPhp, NULL) TIDY_NODE_ME(getParent, NULL) + TIDY_NODE_ME(__construct, NULL) {NULL, NULL, NULL} }; @@ -1880,6 +1882,14 @@ static TIDY_NODE_METHOD(getParent) /* }}} */ +/* {{{ proto void tidyNode::__construct() + __constructor for tidyNode. */ +static TIDY_NODE_METHOD(__construct) +{ + php_error_docref(NULL TSRMLS_CC, E_ERROR, "You should not create a tidyNode manually"); +} +/* }}} */ + static void _php_tidy_register_nodetypes(INIT_FUNC_ARGS) { TIDY_NODE_CONST(ROOT, Root);