cvs: ZendEngine2 / zend_compile.c
| From: | Marcus Boerger | Date: | Wed, 03 Sep 2003 21:21:18 +0000 |
| Subject: | cvs: ZendEngine2 / zend_compile.c | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-1807@lists.php.net to get a copy of this message | ||
helly Wed Sep 3 17:21:18 2003 EDT
Modified files:
/ZendEngine2 zend_compile.c
Log:
Partly revert and reintroduce hash table entries for the ctor.
# Obviously not the brightest idea i had today.
Index: ZendEngine2/zend_compile.c
diff -u ZendEngine2/zend_compile.c:1.480 ZendEngine2/zend_compile.c:1.481
--- ZendEngine2/zend_compile.c:1.480 Wed Sep 3 16:28:13 2003
+++ ZendEngine2/zend_compile.c Wed Sep 3 17:21:18 2003
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_compile.c,v 1.480 2003/09/03 20:28:13 helly Exp $ */
+/* $Id: zend_compile.c,v 1.481 2003/09/03 21:21:18 helly Exp $ */
#include "zend_language_parser.h"
#include "zend.h"
@@ -1582,6 +1582,8 @@
static void do_inherit_parent_constructor(zend_class_entry *ce)
{
+ zend_function *function;
+
if (!ce->parent) {
return;
}
@@ -1605,10 +1607,24 @@
if (!ce->destructor) {
ce->destructor = ce->parent->destructor;
}
- if (!ce->constructor) {
- ce->constructor = ce->parent->constructor;
+ if (ce->constructor) {
+ return;
}
-
+ if (zend_hash_find(&ce->parent->function_table, ZEND_CONSTRUCTOR_FUNC_NAME,
sizeof(ZEND_CONSTRUCTOR_FUNC_NAME), (void **)&function)==SUCCESS) {
+ /* inherit parent's constructor */
+ zend_hash_update(&ce->function_table, ZEND_CONSTRUCTOR_FUNC_NAME,
sizeof(ZEND_CONSTRUCTOR_FUNC_NAME), function, sizeof(zend_function), NULL);
+ function_add_ref(function);
+ } else {
+ /* don't inherit the old style constructor if we already have the new style cconstructor */
+ if (!zend_hash_exists(&ce->function_table, ce->name, ce->name_length+1)) {
+ if (zend_hash_find(&ce->parent->function_table, ce->parent->name,
ce->parent->name_length+1, (void **)&function)==SUCCESS) {
+ /* inherit parent's constructor */
+ zend_hash_update(&ce->function_table, ce->name, ce->name_length+1, function,
sizeof(zend_function), NULL);
+ function_add_ref(function);
+ }
+ }
+ }
+ ce->constructor = ce->parent->constructor;
}