]> granicus.if.org Git - php/commitdiff
Changed tidyNode class to disallow manual node creation.
authorPierrick Charron <pierrick@php.net>
Fri, 25 Dec 2009 21:24:36 +0000 (21:24 +0000)
committerPierrick Charron <pierrick@php.net>
Fri, 25 Dec 2009 21:24:36 +0000 (21:24 +0000)
NEWS
ext/tidy/tests/023.phpt
ext/tidy/tests/025.phpt
ext/tidy/tidy.c

diff --git a/NEWS b/NEWS
index 045bb7bd85586ecc4c89ea0ead71a387d3996b44..9c0668a3f4676fa3645b709e406a5e3d6184cd1b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -5,7 +5,7 @@ PHP                                                                        NEWS
   (Ilia)
 - Removed automatic file descriptor unlocking happening on shutdown and/or 
   stream close (on all OSes excluding Windows). (Tony, Ilia)
-
+- Changed tidyNode class to disallow manual node creation. (Pierrick)
 
 - Fixed build of mysqli with MySQL 5.5.0-m2. (Andrey)
 
index e7ee4b3c0c4961d100c1fd8c7e7bb6a97e3211f7..1f7b02d56bdd50049430a3ddc573034f73e2e526 100644 (file)
@@ -6,16 +6,11 @@ tidy and tidyNode OO
 <?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>');
 
@@ -30,8 +25,6 @@ var_dump(tidy_get_root($tidy)->child[0]->child[0]->hasChildren());
 
 ?>
 --EXPECT--
-object(tidyNode)#1 (0) {
-}
 object(tidy)#1 (2) {
   ["errorBuffer"]=>
   NULL
@@ -39,7 +32,6 @@ object(tidy)#1 (2) {
   NULL
 }
 -------
-bool(false)
 bool(true)
 bool(true)
 bool(false)
index a7bd544d6736e264d78f771f421e23ffb5dce1b1..631ec2e5e96099e7379e669dcf5577a147695ab1 100644 (file)
@@ -5,15 +5,6 @@ tidyNode tests
 --FILE--
 <?php
 
-new tidyNode;
-$node = new tidyNode();
-
-var_dump($node->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)
-string(0) ""
 bool(true)
 bool(true)
 bool(true)
index d97fcc3e2fd82b0ce14578180d929cd3c07a8461..e7696850640fea4e16bd51a6127451790e0100dc 100644 (file)
@@ -266,6 +266,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)
@@ -341,6 +342,7 @@ static 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}
 };
 
@@ -1675,6 +1677,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);