summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rw-r--r--ext/tidy/tests/bug_50558.phpt28
-rw-r--r--ext/tidy/tidy.c15
3 files changed, 29 insertions, 15 deletions
diff --git a/NEWS b/NEWS
index 30a498f42a..5cdc7fa5e3 100644
--- 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
index 0000000000..b37cb92196
--- /dev/null
+++ b/ext/tidy/tests/bug_50558.phpt
@@ -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
+}
diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c
index 3bb1637b80..d45b0825e7 100644
--- a/ext/tidy/tidy.c
+++ b/ext/tidy/tidy.c
@@ -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;