]> granicus.if.org Git - php/commitdiff
Fixed bug #50558 (Broken object model when extending tidy)
authorPierrick Charron <pierrick@php.net>
Fri, 25 Dec 2009 01:35:57 +0000 (01:35 +0000)
committerPierrick Charron <pierrick@php.net>
Fri, 25 Dec 2009 01:35:57 +0000 (01:35 +0000)
NEWS
ext/tidy/tests/bug_50558.phpt [new file with mode: 0644]
ext/tidy/tidy.c

diff --git a/NEWS b/NEWS
index 30a498f42a8cbad96f6df37913869a23dafabd2c..5cdc7fa5e3e94fae496308240b7a588ad62ee579 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -44,6 +44,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 #50508 (compile failure: Conflicting HEADER type declarations).
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 3bb1637b8088493abccfdec393d743e98f6bcdeb..d45b0825e7776e7b11f1fb2b70a8fd6af9b656f8 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);
@@ -740,16 +738,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) {
@@ -1064,9 +1052,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;