johannes                                 Mon, 25 Jan 2010 17:29:37 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=294004

Log:
Merge tidynode changes: (pierrick)

r292635 - Changed tidyNode class to disallow manual node creation.
r292719 - Set the tidyNode constructor private
r292765 - Add a test for tidyNode::__construct()

Changed paths:
    _U  php/php-src/branches/PHP_5_3_2/
    U   php/php-src/branches/PHP_5_3_2/NEWS
    U   php/php-src/branches/PHP_5_3_2/ext/tidy/php_tidy.h
    _U  php/php-src/branches/PHP_5_3_2/ext/tidy/tests/
    U   php/php-src/branches/PHP_5_3_2/ext/tidy/tests/023.phpt
    U   php/php-src/branches/PHP_5_3_2/ext/tidy/tests/025.phpt
    A + php/php-src/branches/PHP_5_3_2/ext/tidy/tests/035.phpt
        (from php/php-src/branches/PHP_5_3/ext/tidy/tests/035.phpt:r292765)
    U   php/php-src/branches/PHP_5_3_2/ext/tidy/tidy.c


Property changes on: php/php-src/branches/PHP_5_3_2
___________________________________________________________________
Modified: svn:mergeinfo
   - 
/php/php-src/branches/PHP_5_3:292504,292574,292594-292595,292611,292624,292630,292632-292634
/php/php-src/trunk:284726
   + 
/php/php-src/branches/PHP_5_3:292504,292574,292594-292595,292611,292624,292630,292632-292635,292719,292765
/php/php-src/trunk:284726

Modified: php/php-src/branches/PHP_5_3_2/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3_2/NEWS 2010-01-25 17:15:41 UTC (rev 294003)
+++ php/php-src/branches/PHP_5_3_2/NEWS 2010-01-25 17:29:37 UTC (rev 294004)
@@ -16,6 +16,7 @@
   (David Soria Parra)
 - Changed "post_max_size" php.ini directive to allow unlimited post size by
   setting it to 0. (Rasmus)
+- Changed tidyNode class to disallow manual node creation. (Pierrick)

 - Removed automatic file descriptor unlocking happening on shutdown and/or
   stream close (on all OSes). (Tony, Ilia)

Modified: php/php-src/branches/PHP_5_3_2/ext/tidy/php_tidy.h
===================================================================
--- php/php-src/branches/PHP_5_3_2/ext/tidy/php_tidy.h  2010-01-25 17:15:41 UTC 
(rev 294003)
+++ php/php-src/branches/PHP_5_3_2/ext/tidy/php_tidy.h  2010-01-25 17:29:37 UTC 
(rev 294004)
@@ -28,6 +28,7 @@
        ZEND_NAMED_FE(name, ZEND_FN(func_name), arg_types)
 #define TIDY_NODE_METHOD(name)    PHP_FUNCTION(tnm_ ##name)
 #define TIDY_NODE_ME(name, param) TIDY_METHOD_MAP(name, tnm_ ##name, param)
+#define TIDY_NODE_PRIVATE_ME(name, param) ZEND_NAMED_ME(name, ZEND_FN(tnm_ 
##name), param, ZEND_ACC_PRIVATE)
 #define TIDY_DOC_METHOD(name)     PHP_FUNCTION(tdm_ ##name)
 #define TIDY_DOC_ME(name, param)  TIDY_METHOD_MAP(name, tdm_ ##name, param)
 #define TIDY_ATTR_METHOD(name)    PHP_FUNCTION(tam_ ##name)


Property changes on: php/php-src/branches/PHP_5_3_2/ext/tidy/tests
___________________________________________________________________
Modified: svn:mergeinfo
   - /php/php-src/branches/PHP_5_3/ext/tidy/tests:292562,292566,292571,292574
/php/php-src/trunk/ext/tidy/tests:284726,287798-287941
   + 
/php/php-src/branches/PHP_5_3/ext/tidy/tests:292562,292566,292571,292574,292635,292719,292765
/php/php-src/trunk/ext/tidy/tests:284726,287798-287941

Modified: php/php-src/branches/PHP_5_3_2/ext/tidy/tests/023.phpt
===================================================================
--- php/php-src/branches/PHP_5_3_2/ext/tidy/tests/023.phpt      2010-01-25 
17:15:41 UTC (rev 294003)
+++ php/php-src/branches/PHP_5_3_2/ext/tidy/tests/023.phpt      2010-01-25 
17:29:37 UTC (rev 294004)
@@ -6,16 +6,11 @@
 <?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 @@

 ?>
 --EXPECT--
-object(tidyNode)#1 (0) {
-}
 object(tidy)#1 (2) {
   ["errorBuffer"]=>
   NULL
@@ -39,7 +32,6 @@
   NULL
 }
 -------
-bool(false)
 bool(true)
 bool(true)
 bool(false)

Modified: php/php-src/branches/PHP_5_3_2/ext/tidy/tests/025.phpt
===================================================================
--- php/php-src/branches/PHP_5_3_2/ext/tidy/tests/025.phpt      2010-01-25 
17:15:41 UTC (rev 294003)
+++ php/php-src/branches/PHP_5_3_2/ext/tidy/tests/025.phpt      2010-01-25 
17:29:37 UTC (rev 294004)
@@ -5,15 +5,6 @@
 --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 @@

 ?>
 --EXPECT--
-bool(false)
-bool(false)
-bool(false)
-bool(false)
-string(0) ""
 bool(true)
 bool(true)
 bool(true)

Copied: php/php-src/branches/PHP_5_3_2/ext/tidy/tests/035.phpt (from rev 
292765, php/php-src/branches/PHP_5_3/ext/tidy/tests/035.phpt)
===================================================================
--- php/php-src/branches/PHP_5_3_2/ext/tidy/tests/035.phpt                      
        (rev 0)
+++ php/php-src/branches/PHP_5_3_2/ext/tidy/tests/035.phpt      2010-01-25 
17:29:37 UTC (rev 294004)
@@ -0,0 +1,12 @@
+--TEST--
+tidyNode::__construct()
+--SKIPIF--
+<?php
+  if (!extension_loaded('tidy')) die ('skip tidy not present');
+?>
+--FILE--
+<?php
+new tidyNode;
+?>
+--EXPECTF--
+Fatal error: Call to private tidyNode::__construct() from invalid context in 
%s on line %d

Modified: php/php-src/branches/PHP_5_3_2/ext/tidy/tidy.c
===================================================================
--- php/php-src/branches/PHP_5_3_2/ext/tidy/tidy.c      2010-01-25 17:15:41 UTC 
(rev 294003)
+++ php/php-src/branches/PHP_5_3_2/ext/tidy/tidy.c      2010-01-25 17:29:37 UTC 
(rev 294004)
@@ -268,6 +268,7 @@
 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 @@
        TIDY_NODE_ME(isAsp, NULL)
        TIDY_NODE_ME(isPhp, NULL)
        TIDY_NODE_ME(getParent, NULL)
+       TIDY_NODE_PRIVATE_ME(__construct, NULL)
        {NULL, NULL, NULL}
 };

@@ -1790,6 +1792,14 @@
 }
 /* }}} */

+/* {{{ 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);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to