cvs: ZendEngine2 / zend_compile.c

From: Date: Sun, 21 Jul 2002 18:50:10 +0000
Subject: cvs: ZendEngine2 / zend_compile.c
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-270@lists.php.net to get a copy of this message
andi Sun Jul 21 14:50:10 2002 EDT Modified files: /ZendEngine2 zend_compile.c Log: - Fix bug reported by Sebastian where old constructors didn't work in - nested classes. Index: ZendEngine2/zend_compile.c diff -u ZendEngine2/zend_compile.c:1.295 ZendEngine2/zend_compile.c:1.296 --- ZendEngine2/zend_compile.c:1.295 Wed Jul 17 14:39:26 2002 +++ ZendEngine2/zend_compile.c Sun Jul 21 14:50:10 2002 @@ -918,8 +918,19 @@ op_array.scope = CG(active_class_entry); if (is_method) { + char *short_class_name = CG(active_class_entry)->name; + zend_uint short_class_name_length = CG(active_class_entry)->name_length; + zend_uint i; + + for (i=0; i < CG(active_class_entry)->name_length; i++) { + if (CG(active_class_entry)->name[i] == ':') { + short_class_name = &CG(active_class_entry)->name[i+1]; + short_class_name_length = strlen(short_class_name); + } + } + zend_hash_update(&CG(active_class_entry)->function_table, name, name_len+1, &op_array, sizeof(zend_op_array), (void **) &CG(active_op_array)); - if ((CG(active_class_entry)->name_length == (uint) name_len) && (!memcmp(CG(active_class_entry)->name, name, name_len))) { + if ((short_class_name_length == name_len) && (!memcmp(short_class_name, name, name_len))) { CG(active_class_entry)->constructor = (zend_function *) CG(active_op_array); } else if ((function_name->u.constant.value.str.len == sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) && (!memcmp(function_name->u.constant.value.str.val, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)))) { CG(active_class_entry)->constructor = (zend_function *) CG(active_op_array); @@ -1151,10 +1162,10 @@ zend_str_tolower(class_name->u.constant.value.str.val, class_name->u.constant.value.str.len); } - length = 1 + result->u.constant.value.str.len + class_name->u.constant.value.str.len; + length = sizeof("::")-1 + result->u.constant.value.str.len + class_name->u.constant.value.str.len; result->u.constant.value.str.val = erealloc(result->u.constant.value.str.val, length+1); - memcpy(&result->u.constant.value.str.val[result->u.constant.value.str.len], ":", sizeof(":")-1); - memcpy(&result->u.constant.value.str.val[result->u.constant.value.str.len+1], class_name->u.constant.value.str.val, class_name->u.constant.value.str.len+1); + memcpy(&result->u.constant.value.str.val[result->u.constant.value.str.len], "::", sizeof("::")-1); + memcpy(&result->u.constant.value.str.val[result->u.constant.value.str.len + sizeof("::")-1], class_name->u.constant.value.str.val, class_name->u.constant.value.str.len+1); STR_FREE(class_name->u.constant.value.str.val); result->u.constant.value.str.len = length; }

« previous php.zend-engine.cvs (#270) next »