]> granicus.if.org Git - php/commitdiff
merge r292620: Fixed bug #50558 (Broken object model when extending tidy)
authorJohannes Schlüter <johannes@php.net>
Thu, 11 Feb 2010 17:36:40 +0000 (17:36 +0000)
committerJohannes Schlüter <johannes@php.net>
Thu, 11 Feb 2010 17:36:40 +0000 (17:36 +0000)
(pierrick)

NEWS
ext/tidy/tests/bug_50558.phpt [new file with mode: 0644]
ext/tidy/tidy.c

diff --git a/NEWS b/NEWS
index dec4d18255c84a405dd123cc09879427b61fd739..48b1a80510a9ba118e0d612e27ef89f4b3beec94 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -102,6 +102,7 @@ PHP                                                                        NEWS
 - Fixed memory leak in extension loading when an error occurs on Windows.
   (Pierre)
 
+- Fixed bug #50558 (Broken object model when extending tidy). (Pierrick)
 - Fixed bug #50540 (Crash while running ldap_next_reference test cases).
   (Sriram)
 - Fixed bug #50519 (segfault in garbage collection when using set_error_handler
diff --git a/ext/tidy/tests/bug_50558.phpt b/ext/tidy/tests/bug_50558.phpt
new file mode 100644 (file)
index 0000000..b37cb92
--- /dev/null
@@ -0,0 +1,28 @@
+--TEST--
+Bug #50558 - Broken object model when extending tidy
+--SKIPIF--
+<?php if (!extension_loaded("tidy")) print "skip"; ?>
+--FILE--
+<?php
+class MyTidy extends tidy
+{
+            // foo
+}
+
+function doSomething(MyTidy $o)
+{
+            var_dump($o);
+}
+
+$o = new MyTidy();
+var_dump($o instanceof MyTidy);
+doSomething($o);
+?>
+--EXPECTF--
+bool(true)
+object(MyTidy)#%d (%d) {
+  ["errorBuffer"]=>
+  NULL
+  ["value"]=>
+  NULL
+}
index 28982d7b19def4d075b3f4ea913a7e7a6d24aff6..dfc15d97f0257aa9f3c8da57f5ac40aa53efb472 100644 (file)
@@ -206,8 +206,6 @@ static char *php_tidy_file_to_mem(char *, zend_bool, int * TSRMLS_DC);
 static void tidy_object_free_storage(void * TSRMLS_DC);
 static zend_object_value tidy_object_new_node(zend_class_entry * TSRMLS_DC);
 static zend_object_value tidy_object_new_doc(zend_class_entry * TSRMLS_DC);
-static zend_class_entry *tidy_get_ce_node(const zval * TSRMLS_DC);
-static zend_class_entry *tidy_get_ce_doc(const zval * TSRMLS_DC);
 static zval * tidy_instanciate(zend_class_entry *, zval * TSRMLS_DC);
 static int tidy_doc_cast_handler(zval *, zval *, int TSRMLS_DC);
 static int tidy_node_cast_handler(zval *, zval *, int TSRMLS_DC);
@@ -742,16 +740,6 @@ static zend_object_value tidy_object_new_doc(zend_class_entry *class_type TSRMLS
        return retval;
 }
 
-static zend_class_entry *tidy_get_ce_node(const zval *object TSRMLS_DC)
-{
-       return tidy_ce_node;
-}
-
-static zend_class_entry *tidy_get_ce_doc(const zval *object TSRMLS_DC)
-{
-       return tidy_ce_doc;
-}
-
 static zval * tidy_instanciate(zend_class_entry *pce, zval *object TSRMLS_DC)
 {
        if (!object) {
@@ -1066,9 +1054,6 @@ static PHP_MINIT_FUNCTION(tidy)
        REGISTER_TIDY_CLASS(tidy, doc,  NULL, 0);
        REGISTER_TIDY_CLASS(tidyNode, node,     NULL, ZEND_ACC_FINAL_CLASS);
 
-       tidy_object_handlers_doc.get_class_entry = tidy_get_ce_doc;
-       tidy_object_handlers_node.get_class_entry = tidy_get_ce_node;
-       
        tidy_object_handlers_doc.cast_object = tidy_doc_cast_handler;
        tidy_object_handlers_node.cast_object = tidy_node_cast_handler;