Fixed bug #50558 (Broken object model when extending tidy)

This commit is contained in:
Pierrick Charron 2009-12-25 01:35:57 +00:00
parent c2296af6a6
commit 3cc801b9b0
3 changed files with 29 additions and 15 deletions

1
NEWS
View File

@ -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).

View File

@ -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
}

View 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;