cvs: ZendEngine2 / zend.c zend_compile.c zend_execute.c zend_execute_API.c zend_globals.h zend_ini.c zend_ini.h zend_variables.c
| From: | Zeev Suraski | Date: | Sun, 12 Jan 2003 12:39:06 +0000 |
| Subject: | cvs: ZendEngine2 / zend.c zend_compile.c zend_execute.c zend_execute_API.c zend_globals.h zend_ini.c zend_ini.h zend_variables.c | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-792@lists.php.net to get a copy of this message | ||
zeev Sun Jan 12 07:39:06 2003 EDT
Modified files:
/ZendEngine2 zend.c zend_compile.c zend_execute.c
zend_execute_API.c zend_globals.h zend_ini.c
zend_ini.h zend_variables.c
Log:
Implemented compatibility mode
To enable - zend2.implicit_clone = on in php.ini or using ini_set()
Index: ZendEngine2/zend.c
diff -u ZendEngine2/zend.c:1.200 ZendEngine2/zend.c:1.201
--- ZendEngine2/zend.c:1.200 Sat Jan 11 11:12:43 2003
+++ ZendEngine2/zend.c Sun Jan 12 07:39:06 2003
@@ -69,8 +69,20 @@
}
+static ZEND_INI_MH(OnUpdateImplicitClone)
+{
+ if (!new_value) {
+ EG(implicit_clone) = 0;
+ } else {
+ EG(implicit_clone) = atoi(new_value) ? 1 : 0;
+ }
+ return SUCCESS;
+}
+
+
ZEND_INI_BEGIN()
ZEND_INI_ENTRY("error_reporting", NULL, ZEND_INI_ALL, OnUpdateErrorReporting)
+ ZEND_INI_ENTRY("zend2.implicit_clone", NULL, ZEND_INI_ALL, OnUpdateImplicitClone)
ZEND_INI_END()
@@ -268,7 +280,7 @@
ZEND_PUTS(" *RECURSION*");
object->properties->nApplyCount--;
return;
- }
+ }
zend_printf("%s Object (", object->ce->name);
print_flat_hash(object->properties);
ZEND_PUTS(")");
@@ -287,7 +299,7 @@
}
-ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int indent)
+ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int indent)
{
switch (expr->type) {
case IS_ARRAY:
@@ -333,7 +345,7 @@
static void register_standard_class(void)
{
zend_standard_class_def = malloc(sizeof(zend_class_entry));
-
+
zend_standard_class_def->type = ZEND_INTERNAL_CLASS;
zend_standard_class_def->name_length = sizeof("stdClass") - 1;
zend_standard_class_def->name = zend_strndup("stdClass",
zend_standard_class_def->name_length);
@@ -730,7 +742,7 @@
void zend_deactivate(TSRMLS_D)
{
/* we're no longer executing anything */
- EG(opline_ptr) = NULL;
+ EG(opline_ptr) = NULL;
EG(active_symbol_table) = NULL;
zend_try {
@@ -864,7 +876,7 @@
z_error_filename->value.str.val = estrndup(error_filename,
z_error_filename->value.str.len);
z_error_filename->type = IS_STRING;
}
-
+
z_error_lineno->value.lval = error_lineno;
z_error_lineno->type = IS_LONG;
@@ -944,7 +956,7 @@
zend_file_handle *file_handle;
zend_op_array *orig_op_array = EG(active_op_array);
zval *local_retval=NULL;
-
+
va_start(files, file_count);
for (i=0; i<file_count; i++) {
file_handle = va_arg(files, zend_file_handle *);
Index: ZendEngine2/zend_compile.c
diff -u ZendEngine2/zend_compile.c:1.341 ZendEngine2/zend_compile.c:1.342
--- ZendEngine2/zend_compile.c:1.341 Thu Jan 9 11:16:57 2003
+++ ZendEngine2/zend_compile.c Sun Jan 12 07:39:06 2003
@@ -208,7 +208,6 @@
zend_op *last_op = &CG(active_op_array)->opcodes[last_op_number];
if (last_op->opcode == ZEND_FETCH_OBJ_RW) {
-
switch (op) {
case ZEND_ASSIGN_ADD:
opline->opcode = ZEND_ASSIGN_ADD_OBJ;
Index: ZendEngine2/zend_execute.c
diff -u ZendEngine2/zend_execute.c:1.407 ZendEngine2/zend_execute.c:1.408
--- ZendEngine2/zend_execute.c:1.407 Sat Jan 11 12:04:16 2003
+++ ZendEngine2/zend_execute.c Sun Jan 12 07:39:06 2003
@@ -304,6 +304,11 @@
break;
}
+ if (EG(implicit_clone)) {
+ SEPARATE_ZVAL_IF_NOT_REF(object_ptr);
+ object = *object_ptr;
+ }
+
/* here property is a string */
Z_OBJ_HT_P(object)->write_property(object, property, value TSRMLS_CC);
Index: ZendEngine2/zend_execute_API.c
diff -u ZendEngine2/zend_execute_API.c:1.187 ZendEngine2/zend_execute_API.c:1.188
--- ZendEngine2/zend_execute_API.c:1.187 Sat Jan 11 11:12:44 2003
+++ ZendEngine2/zend_execute_API.c Sun Jan 12 07:39:06 2003
@@ -129,6 +129,7 @@
EG(symtable_cache_ptr) = EG(symtable_cache)-1;
EG(symtable_cache_limit)=EG(symtable_cache)+SYMTABLE_CACHE_SIZE-1;
EG(no_extensions)=0;
+ EG(implicit_clone)=0;
EG(function_table) = CG(function_table);
EG(class_table) = CG(class_table);
Index: ZendEngine2/zend_globals.h
diff -u ZendEngine2/zend_globals.h:1.113 ZendEngine2/zend_globals.h:1.114
--- ZendEngine2/zend_globals.h:1.113 Sun Jan 5 11:09:59 2003
+++ ZendEngine2/zend_globals.h Sun Jan 12 07:39:06 2003
@@ -177,6 +177,7 @@
zend_bool in_execution;
zend_bool bailout_set;
zend_bool full_tables_cleanup;
+ zend_bool implicit_clone;
/* for extended information support */
zend_bool no_extensions;
Index: ZendEngine2/zend_ini.c
diff -u ZendEngine2/zend_ini.c:1.26 ZendEngine2/zend_ini.c:1.27
--- ZendEngine2/zend_ini.c:1.26 Tue Dec 31 10:54:08 2002
+++ ZendEngine2/zend_ini.c Sun Jan 12 07:39:06 2003
@@ -75,6 +75,15 @@
ZEND_API int zend_ini_shutdown(TSRMLS_D)
{
zend_hash_destroy(EG(ini_directives));
+ free(EG(ini_directives));
+ return SUCCESS;
+}
+
+
+ZEND_API int zend_ini_global_shutdown(TSRMLS_D)
+{
+ zend_hash_destroy(registered_zend_ini_directives);
+ free(registered_zend_ini_directives);
return SUCCESS;
}
Index: ZendEngine2/zend_ini.h
diff -u ZendEngine2/zend_ini.h:1.21 ZendEngine2/zend_ini.h:1.22
--- ZendEngine2/zend_ini.h:1.21 Tue Dec 31 10:54:08 2002
+++ ZendEngine2/zend_ini.h Sun Jan 12 07:39:06 2003
@@ -84,6 +84,7 @@
ZEND_API int zend_ini_startup(TSRMLS_D);
ZEND_API int zend_ini_shutdown(TSRMLS_D);
+ZEND_API int zend_ini_global_shutdown(TSRMLS_D);
ZEND_API int zend_ini_deactivate(TSRMLS_D);
ZEND_API int zend_copy_ini_directives(TSRMLS_D);
Index: ZendEngine2/zend_variables.c
diff -u ZendEngine2/zend_variables.c:1.49 ZendEngine2/zend_variables.c:1.50
--- ZendEngine2/zend_variables.c:1.49 Tue Dec 31 10:54:08 2002
+++ ZendEngine2/zend_variables.c Sun Jan 12 07:39:06 2003
@@ -126,11 +126,12 @@
case IS_OBJECT:
{
TSRMLS_FETCH();
-#if 0
- zvalue->value.obj =
zvalue->value.obj.handlers->clone_obj(zvalue->value.obj.handle);
-#else
- Z_OBJ_HT_P(zvalue)->add_ref(zvalue TSRMLS_CC);
-#endif
+
+ if (EG(implicit_clone)) {
+ zvalue->value.obj = zvalue->value.obj.handlers->clone_obj(zvalue TSRMLS_CC);
+ } else {
+ Z_OBJ_HT_P(zvalue)->add_ref(zvalue TSRMLS_CC);
+ }
}
break;
}