pierrick Fri, 25 Dec 2009 01:35:57 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=292620
Log: Fixed bug #50558 (Broken object model when extending tidy) Bug: http://bugs.php.net/50558 (Open) Broken object model when extending tidy Changed paths: U php/php-src/branches/PHP_5_2/NEWS A php/php-src/branches/PHP_5_2/ext/tidy/tests/bug_50558.phpt U php/php-src/branches/PHP_5_2/ext/tidy/tidy.c U php/php-src/branches/PHP_5_3/NEWS A php/php-src/branches/PHP_5_3/ext/tidy/tests/bug_50558.phpt U php/php-src/branches/PHP_5_3/ext/tidy/tidy.c A php/php-src/trunk/ext/tidy/tests/bug_50558.phpt U php/php-src/trunk/ext/tidy/tidy.c
Modified: php/php-src/branches/PHP_5_2/NEWS =================================================================== --- php/php-src/branches/PHP_5_2/NEWS 2009-12-25 00:49:08 UTC (rev 292619) +++ php/php-src/branches/PHP_5_2/NEWS 2009-12-25 01:35:57 UTC (rev 292620) @@ -6,6 +6,7 @@ - Fixed build of mysqli with MySQL 5.5.0-m2. (Andrey) +- 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). Added: php/php-src/branches/PHP_5_2/ext/tidy/tests/bug_50558.phpt =================================================================== --- php/php-src/branches/PHP_5_2/ext/tidy/tests/bug_50558.phpt (rev 0) +++ php/php-src/branches/PHP_5_2/ext/tidy/tests/bug_50558.phpt 2009-12-25 01:35:57 UTC (rev 292620) @@ -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 +} Modified: php/php-src/branches/PHP_5_2/ext/tidy/tidy.c =================================================================== --- php/php-src/branches/PHP_5_2/ext/tidy/tidy.c 2009-12-25 00:49:08 UTC (rev 292619) +++ php/php-src/branches/PHP_5_2/ext/tidy/tidy.c 2009-12-25 01:35:57 UTC (rev 292620) @@ -206,8 +206,6 @@ 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(zval * TSRMLS_DC); -static zend_class_entry *tidy_get_ce_doc(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); @@ -640,16 +638,6 @@ return retval; } -static zend_class_entry *tidy_get_ce_node(zval *object TSRMLS_DC) -{ - return tidy_ce_node; -} - -static zend_class_entry *tidy_get_ce_doc(zval *object TSRMLS_DC) -{ - return tidy_ce_doc; -} - static zval * tidy_instanciate(zend_class_entry *pce, zval *object TSRMLS_DC) { if (!object) { @@ -964,9 +952,6 @@ 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; Modified: php/php-src/branches/PHP_5_3/NEWS =================================================================== --- php/php-src/branches/PHP_5_3/NEWS 2009-12-25 00:49:08 UTC (rev 292619) +++ php/php-src/branches/PHP_5_3/NEWS 2009-12-25 01:35:57 UTC (rev 292620) @@ -44,6 +44,7 @@ - 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). Added: php/php-src/branches/PHP_5_3/ext/tidy/tests/bug_50558.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/tidy/tests/bug_50558.phpt (rev 0) +++ php/php-src/branches/PHP_5_3/ext/tidy/tests/bug_50558.phpt 2009-12-25 01:35:57 UTC (rev 292620) @@ -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 +} Modified: php/php-src/branches/PHP_5_3/ext/tidy/tidy.c =================================================================== --- php/php-src/branches/PHP_5_3/ext/tidy/tidy.c 2009-12-25 00:49:08 UTC (rev 292619) +++ php/php-src/branches/PHP_5_3/ext/tidy/tidy.c 2009-12-25 01:35:57 UTC (rev 292620) @@ -206,8 +206,6 @@ 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 @@ 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 @@ 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; Added: php/php-src/trunk/ext/tidy/tests/bug_50558.phpt =================================================================== --- php/php-src/trunk/ext/tidy/tests/bug_50558.phpt (rev 0) +++ php/php-src/trunk/ext/tidy/tests/bug_50558.phpt 2009-12-25 01:35:57 UTC (rev 292620) @@ -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) { + [%c"errorBuffer"]=> + NULL + [%c"value"]=> + NULL +} Modified: php/php-src/trunk/ext/tidy/tidy.c =================================================================== --- php/php-src/trunk/ext/tidy/tidy.c 2009-12-25 00:49:08 UTC (rev 292619) +++ php/php-src/trunk/ext/tidy/tidy.c 2009-12-25 01:35:57 UTC (rev 292620) @@ -213,8 +213,6 @@ 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, void * TSRMLS_DC); static int tidy_node_cast_handler(zval *, zval *, int, void * TSRMLS_DC); @@ -739,16 +737,6 @@ 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) { @@ -1113,9 +1101,6 @@ 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;
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php