zend_register_class() overwrites ce->create_object with parent_ce->create_object?
| From: | Michael Wallner | Date: | Thu, 02 Sep 2010 16:04:12 +0000 |
| Subject: | zend_register_class() overwrites ce->create_object with parent_ce->create_object? | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-49557@lists.php.net to get a copy of this message | ||
If I define a descendant class, I *obviously* know what create_object should
do, as this should only effect internal classes. So could anybody please
explain to me why the parent's create_object is enforced?
It causes to write hacks like:
---8<---
zend_class_entry *ce;
zend_object_value (*__create_object)(zend_class_entry *ce TSRMLS_DC);
INIT_CLASS_ENTRY(ce, "classname", php_my_method_entry);
ce.create_object = php_my_object_new;
/* hack starts here */
__create_object = parent_ce->create_object;
parent_ce->create_object = php_my_object_new;
php_my_class_entry = zend_register_internal_class_ex(&ce, parent_ce, NULL TSRMLS_CC);
parent->create_object = __create_object;
--->8---
If this limitation is there without a really good reason, I'd like to get rid of it.
Thanks,
Mike