diff options
author | Felipe Pena <felipe@php.net> | 2008-03-18 14:10:45 +0000 |
---|---|---|
committer | Felipe Pena <felipe@php.net> | 2008-03-18 14:10:45 +0000 |
commit | 2b10c53ae16bb79c5f6dd0da61d6b3c451251802 (patch) | |
tree | 97ff7a379e380d56f87547587fafb8540761ad25 | |
parent | 8b01532f64cfeb88270b1a8b13c52dd76aa3d999 (diff) | |
download | php-git-2b10c53ae16bb79c5f6dd0da61d6b3c451251802.tar.gz |
MFH: Dropped zend.ze1_compatibility_mode
[DOC]
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | Zend/tests/bug30332.phpt | 40 | ||||
-rw-r--r-- | Zend/tests/bug31828.phpt | 25 | ||||
-rw-r--r-- | Zend/tests/bug32080.phpt | 18 | ||||
-rw-r--r-- | Zend/tests/bug32852.phpt | 38 | ||||
-rwxr-xr-x | Zend/tests/bug33243.phpt | 25 | ||||
-rwxr-xr-x | Zend/tests/bug34712.phpt | 28 | ||||
-rwxr-xr-x | Zend/tests/bug34767.phpt | 33 | ||||
-rw-r--r-- | Zend/zend.c | 1 | ||||
-rw-r--r-- | Zend/zend_API.c | 28 | ||||
-rw-r--r-- | Zend/zend_execute.c | 94 | ||||
-rw-r--r-- | Zend/zend_execute.h | 9 | ||||
-rw-r--r-- | Zend/zend_execute_API.c | 5 | ||||
-rw-r--r-- | Zend/zend_globals.h | 1 | ||||
-rw-r--r-- | Zend/zend_objects.c | 27 | ||||
-rw-r--r-- | Zend/zend_operators.c | 38 | ||||
-rw-r--r-- | Zend/zend_vm_def.h | 20 | ||||
-rw-r--r-- | Zend/zend_vm_execute.h | 80 | ||||
-rw-r--r-- | ext/dom/php_dom.c | 22 | ||||
-rw-r--r-- | ext/simplexml/simplexml.c | 47 | ||||
-rw-r--r-- | main/main.c | 16 |
21 files changed, 36 insertions, 560 deletions
@@ -2,6 +2,7 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 20??, PHP 5.3.0 - Removed the experimental RPL (master/slave) functions from mysqli. (Andrey) +- Dropped zend.ze1_compatibility_mode (Dmitry) - Added concept of "delayed early binding" that allows opcode caches to perform class declaration (early and/or run-time binding) in exactly the same order diff --git a/Zend/tests/bug30332.phpt b/Zend/tests/bug30332.phpt deleted file mode 100644 index e2478498cd..0000000000 --- a/Zend/tests/bug30332.phpt +++ /dev/null @@ -1,40 +0,0 @@ ---TEST-- -Bug #30332 (zend.ze1_compatibility_mode isnt fully compatable with array_push()) ---INI-- -zend.ze1_compatibility_mode=on -error_reporting=4095 ---FILE-- -<?php -class x { }; - -$first = new x; -$second = $first; -$container = array(); -array_push($container, $first); - -$first->first = " im in the first"; - -print_r($first); -print_r($second); -print_r($container); -?> ---EXPECTF-- -Strict Standards: Implicit cloning object of class 'x' because of 'zend.ze1_compatibility_mode' in %sbug30332.php on line 4 - -Strict Standards: Implicit cloning object of class 'x' because of 'zend.ze1_compatibility_mode' in %sbug30332.php on line 5 - -Strict Standards: Implicit cloning object of class 'x' because of 'zend.ze1_compatibility_mode' in %sbug30332.php on line 7 -x Object -( - [first] => im in the first -) -x Object -( -) -Array -( - [0] => x Object - ( - ) - -) diff --git a/Zend/tests/bug31828.phpt b/Zend/tests/bug31828.phpt deleted file mode 100644 index a3cc4542fd..0000000000 --- a/Zend/tests/bug31828.phpt +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -Bug #31828 (Crash with zend.ze1_compatibility_mode=On) ---INI-- -zend.ze1_compatibility_mode=on -error_reporting=4095 ---FILE-- -<?php -$o = new stdClass(); -$o->id = 77; -$o->name = "Aerospace"; -$a[] = $o; -$a = $a[0]; -print_r($a); -?> ---EXPECTF-- -Strict Standards: Implicit cloning object of class 'stdClass' because of 'zend.ze1_compatibility_mode' in %sbug31828.php on line 2 - -Strict Standards: Implicit cloning object of class 'stdClass' because of 'zend.ze1_compatibility_mode' in %sbug31828.php on line 5 - -Strict Standards: Implicit cloning object of class 'stdClass' because of 'zend.ze1_compatibility_mode' in %sbug31828.php on line 6 -stdClass Object -( - [id] => 77 - [name] => Aerospace -) diff --git a/Zend/tests/bug32080.phpt b/Zend/tests/bug32080.phpt deleted file mode 100644 index a96c8bf262..0000000000 --- a/Zend/tests/bug32080.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -Bug #32080 (segfault when assigning object to itself with zend.ze1_compatibility_mode=On) ---INI-- -zend.ze1_compatibility_mode=on -error_reporting=4095 ---FILE-- -<?php -class test { } -$t = new test; -$t = $t; // gives segfault -var_dump($t); -?> ---EXPECTF-- -Strict Standards: Implicit cloning object of class 'test' because of 'zend.ze1_compatibility_mode' in %sbug32080.php on line 3 - -Strict Standards: Implicit cloning object of class 'test' because of 'zend.ze1_compatibility_mode' in %sbug32080.php on line 5 -object(test)#%d (0) { -} diff --git a/Zend/tests/bug32852.phpt b/Zend/tests/bug32852.phpt deleted file mode 100644 index 38cea6f145..0000000000 --- a/Zend/tests/bug32852.phpt +++ /dev/null @@ -1,38 +0,0 @@ ---TEST-- -Bug #32852 (Crash with singleton and __destruct when zend.ze1_compatibility_mode = On) ---INI-- -zend.ze1_compatibility_mode=on -error_reporting=4095 ---FILE-- -<?php -class crashme { - private static $instance = null; - - public function __construct() { - self::$instance = $this; - } - - public function __destruct() { - echo "i'm called\n"; - } - - public static function singleton() { - if (!isset(self::$instance)) { - self::$instance = new crashme(); - } - return self::$instance; - } -} - -crashme::singleton(); -?> ---EXPECTF-- -Strict Standards: Implicit cloning object of class 'crashme' because of 'zend.ze1_compatibility_mode' in %sbug32852.php on line 6 -i'm called - -Strict Standards: Implicit cloning object of class 'crashme' because of 'zend.ze1_compatibility_mode' in %sbug32852.php on line 15 -i'm called - -Strict Standards: Implicit cloning object of class 'crashme' because of 'zend.ze1_compatibility_mode' in %sbug32852.php on line 17 -i'm called -i'm called diff --git a/Zend/tests/bug33243.phpt b/Zend/tests/bug33243.phpt deleted file mode 100755 index bb5d77c7bf..0000000000 --- a/Zend/tests/bug33243.phpt +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -Bug #33243 (ze1_compatibility_mode does not work as expected) ---INI-- -zend.ze1_compatibility_mode=1 -error_reporting=4095 ---FILE-- -<?php -$a->y->z = 0; -$b = $a; // should perform deep copy of $a -$b->y->z = 1; // hence this should have no effect on $a -var_dump($a); -?> ---EXPECTF-- -Strict Standards: Creating default object from empty value in %sbug33243.php on line 2 - -Strict Standards: Implicit cloning object of class 'stdClass' because of 'zend.ze1_compatibility_mode' in %sbug33243.php on line 3 - -Strict Standards: Implicit cloning object of class 'stdClass' because of 'zend.ze1_compatibility_mode' in %sbug33243.php on line 5 -object(stdClass)#%d (1) { - ["y"]=> - object(stdClass)#%d (1) { - ["z"]=> - int(0) - } -} diff --git a/Zend/tests/bug34712.phpt b/Zend/tests/bug34712.phpt deleted file mode 100755 index 8176292bd2..0000000000 --- a/Zend/tests/bug34712.phpt +++ /dev/null @@ -1,28 +0,0 @@ ---TEST-- -Bug #34712 (zend.ze1_compatibility_mode = on segfault) ---INI-- -zend.ze1_compatibility_mode=1 -error_reporting=4095 ---FILE-- -<?php -class foo { - function foo(&$obj_ref) { - $this->bar = &$obj_ref; - } -} - - -class bar { - function bar() { - $this->foo = new foo($this); - } -} - -$test = new bar; -echo "ok\n"; -?> ---EXPECTF-- -Strict Standards: Implicit cloning object of class 'foo' because of 'zend.ze1_compatibility_mode' in %sbug34712.php on line 11 - -Strict Standards: Implicit cloning object of class 'bar' because of 'zend.ze1_compatibility_mode' in %sbug34712.php on line 15 -ok diff --git a/Zend/tests/bug34767.phpt b/Zend/tests/bug34767.phpt deleted file mode 100755 index eaede243fc..0000000000 --- a/Zend/tests/bug34767.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -Bug #34767 (Zend Engine 1 Compatibility not copying objects correctly) ---INI-- -zend.ze1_compatibility_mode=1 -error_reporting=E_ALL | E_DEPRECATED | E_STRICT ---FILE-- -<?php -$a->y = &new stdClass(); -print_r($a); -$b = $a; -$a->y->z = 1; -print_r($b); -?> ---EXPECTF-- - -Deprecated: Assigning the return value of new by reference is deprecated in %sbug34767.php on line 2 -stdClass Object -( - [y] => stdClass Object - ( - ) - -) - -Strict Standards: Implicit cloning object of class 'stdClass' because of 'zend.ze1_compatibility_mode' in %sbug34767.php on line 4 -stdClass Object -( - [y] => stdClass Object - ( - [z] => 1 - ) - -) diff --git a/Zend/zend.c b/Zend/zend.c index 97fe82080c..1f1fa582c1 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -90,7 +90,6 @@ static ZEND_INI_MH(OnUpdateGCEnabled) /* {{{ */ ZEND_INI_BEGIN() ZEND_INI_ENTRY("error_reporting", NULL, ZEND_INI_ALL, OnUpdateErrorReporting) STD_ZEND_INI_BOOLEAN("zend.enable_gc", "1", ZEND_INI_ALL, OnUpdateGCEnabled, gc_enabled, zend_gc_globals, gc_globals) - STD_ZEND_INI_BOOLEAN("zend.ze1_compatibility_mode", "0", ZEND_INI_ALL, OnUpdateBool, ze1_compatibility_mode, zend_executor_globals, executor_globals) ZEND_INI_END() diff --git a/Zend/zend_API.c b/Zend/zend_API.c index cfa354a8d5..9cc9b7d023 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -153,34 +153,6 @@ ZEND_API int _zend_get_parameters_array_ex(int param_count, zval ***argument_arr while (param_count-->0) { zval **value = (zval**)(p-arg_count); - if (EG(ze1_compatibility_mode) && - Z_TYPE_PP(value) == IS_OBJECT && - !Z_ISREF_PP(value) - ) { - zval *value_ptr; - char *class_name; - zend_uint class_name_len; - int dup; - - dup = zend_get_object_classname(*value, &class_name, &class_name_len TSRMLS_CC); - - ALLOC_ZVAL(value_ptr); - *value_ptr = **value; - INIT_PZVAL(value_ptr); - zend_error(E_STRICT, "Implicit cloning object of class '%s' because of 'zend.ze1_compatibility_mode'", class_name); - - if (Z_OBJ_HANDLER_PP(value, clone_obj) == NULL) { - zend_error(E_CORE_ERROR, "Trying to clone uncloneable object of class %s", class_name); - } - - if(!dup) { - efree(class_name); - } - - value_ptr->value.obj = Z_OBJ_HANDLER_PP(value, clone_obj)(*value TSRMLS_CC); - zval_ptr_dtor(value); - *value = value_ptr; - } *(argument_array++) = value; arg_count--; } diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 0d3b8450eb..40f6df7b57 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -560,26 +560,7 @@ static inline void zend_assign_to_object(znode *result, zval **object_ptr, zval object = *object_ptr; /* separate our value if necessary */ - if (EG(ze1_compatibility_mode) && Z_TYPE_P(value) == IS_OBJECT) { - zval *orig_value = value; - char *class_name; - zend_uint class_name_len; - int dup; - - ALLOC_ZVAL(value); - *value = *orig_value; - Z_UNSET_ISREF_P(value); - Z_SET_REFCOUNT_P(value, 0); - dup = zend_get_object_classname(orig_value, &class_name, &class_name_len TSRMLS_CC); - if (Z_OBJ_HANDLER_P(value, clone_obj) == NULL) { - zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %s", class_name); - } - zend_error(E_STRICT, "Implicit cloning object of class '%s' because of 'zend.ze1_compatibility_mode'", class_name); - value->value.obj = Z_OBJ_HANDLER_P(orig_value, clone_obj)(orig_value TSRMLS_CC); - if(!dup) { - efree(class_name); - } - } else if (value_op->op_type == IS_TMP_VAR) { + if (value_op->op_type == IS_TMP_VAR) { zval *orig_value = value; ALLOC_ZVAL(value); @@ -686,49 +667,7 @@ static inline zval* zend_assign_to_variable(zval **variable_ptr_ptr, zval *value return variable_ptr; } - if (EG(ze1_compatibility_mode) && Z_TYPE_P(value) == IS_OBJECT) { - char *class_name; - zend_uint class_name_len; - int dup; - - dup = zend_get_object_classname(value, &class_name, &class_name_len TSRMLS_CC); - - if (Z_OBJ_HANDLER_P(value, clone_obj) == NULL) { - zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %s", class_name); - } else if (PZVAL_IS_REF(variable_ptr)) { - if (variable_ptr != value) { - zend_uint refcount = Z_REFCOUNT_P(variable_ptr); - - garbage = *variable_ptr; - *variable_ptr = *value; - Z_SET_REFCOUNT_P(variable_ptr, refcount); - Z_SET_ISREF_P(variable_ptr); - zend_error(E_STRICT, "Implicit cloning object of class '%s' because of 'zend.ze1_compatibility_mode'", class_name); - variable_ptr->value.obj = Z_OBJ_HANDLER_P(value, clone_obj)(value TSRMLS_CC); - zendi_zval_dtor(garbage); - return variable_ptr; - } - } else { - if (variable_ptr != value) { - Z_ADDREF_P(value); - Z_DELREF_P(variable_ptr); - if (Z_REFCOUNT_P(variable_ptr) == 0) { - zendi_zval_dtor(*variable_ptr); - } else { - ALLOC_ZVAL(variable_ptr); - *variable_ptr_ptr = variable_ptr; - } - *variable_ptr = *value; - INIT_PZVAL(variable_ptr); - zend_error(E_STRICT, "Implicit cloning object of class '%s' because of 'zend.ze1_compatibility_mode'", class_name); - variable_ptr->value.obj = Z_OBJ_HANDLER_P(value, clone_obj)(value TSRMLS_CC); - zval_ptr_dtor(&value); - } - } - if (!dup) { - efree(class_name); - } - } else if (PZVAL_IS_REF(variable_ptr)) { + if (PZVAL_IS_REF(variable_ptr)) { if (variable_ptr!=value) { zend_uint refcount = Z_REFCOUNT_P(variable_ptr); @@ -798,32 +737,9 @@ static inline void zend_receive(zval **variable_ptr_ptr, zval *value TSRMLS_DC) { zval *variable_ptr = *variable_ptr_ptr; - if (EG(ze1_compatibility_mode) && Z_TYPE_P(value) == IS_OBJECT) { - char *class_name; - zend_uint class_name_len; - int dup; - - dup = zend_get_object_classname(value, &class_name, &class_name_len TSRMLS_CC); - - if (Z_OBJ_HANDLER_P(value, clone_obj) == NULL) { - zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %s", class_name); - } else { - Z_DELREF_P(variable_ptr); - ALLOC_ZVAL(variable_ptr); - *variable_ptr_ptr = variable_ptr; - *variable_ptr = *value; - INIT_PZVAL(variable_ptr); - zend_error(E_STRICT, "Implicit cloning object of class '%s' because of 'zend.ze1_compatibility_mode'", class_name); - variable_ptr->value.obj = Z_OBJ_HANDLER_P(value, clone_obj)(value TSRMLS_CC); - } - if (!dup) { - efree(class_name); - } - } else { - Z_DELREF_P(variable_ptr); - *variable_ptr_ptr = value; - Z_ADDREF_P(value); - } + Z_DELREF_P(variable_ptr); + *variable_ptr_ptr = value; + Z_ADDREF_P(value); } /* Utility Functions for Extensions */ diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h index 975bdc8ec0..147d98546b 100644 --- a/Zend/zend_execute.h +++ b/Zend/zend_execute.h @@ -122,15 +122,8 @@ static inline int i_zend_is_true(zval *op) break; } } - - if(EG(ze1_compatibility_mode)) { - result = (zend_hash_num_elements(Z_OBJPROP_P(op))?1:0); - } else { - result = 1; - } - } else { - result = 1; } + result = 1; break; default: result = 0; diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 3f646162a2..34b9957bb7 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -425,11 +425,6 @@ ZEND_API void _zval_ptr_dtor(zval **zval_ptr ZEND_FILE_LINE_DC) /* {{{ */ TSRMLS_FETCH(); if (Z_REFCOUNT_PP(zval_ptr) == 1) { - if ((*zval_ptr)->type == IS_OBJECT) { - if (EG(ze1_compatibility_mode)) { - return; - } - } Z_UNSET_ISREF_PP(zval_ptr); } diff --git a/Zend/zend_globals.h b/Zend/zend_globals.h index b387c5db1a..0b6214ab1e 100644 --- a/Zend/zend_globals.h +++ b/Zend/zend_globals.h @@ -186,7 +186,6 @@ struct _zend_executor_globals { HashTable *in_autoload; zend_function *autoload_func; zend_bool full_tables_cleanup; - zend_bool ze1_compatibility_mode; /* for extended information support */ zend_bool no_extensions; diff --git a/Zend/zend_objects.c b/Zend/zend_objects.c index 5d131f1077..3dcc15eaaf 100644 --- a/Zend/zend_objects.c +++ b/Zend/zend_objects.c @@ -140,33 +140,10 @@ ZEND_API zend_object *zend_objects_get_address(zval *zobject TSRMLS_DC) return (zend_object *)zend_object_store_get_object(zobject TSRMLS_CC); } -static void zval_add_ref_or_clone(zval **p) -{ - if (Z_TYPE_PP(p) == IS_OBJECT && !PZVAL_IS_REF(*p)) { - TSRMLS_FETCH(); - - if (Z_OBJ_HANDLER_PP(p, clone_obj) == NULL) { - zend_error(E_ERROR, "Trying to clone an uncloneable object of class %s", Z_OBJCE_PP(p)->name); - } else { - zval *orig = *p; - - ALLOC_ZVAL(*p); - **p = *orig; - INIT_PZVAL(*p); - (*p)->value.obj = Z_OBJ_HT_PP(p)->clone_obj(orig TSRMLS_CC); - } - } else { - Z_ADDREF_PP(p); - } -} - ZEND_API void zend_objects_clone_members(zend_object *new_object, zend_object_value new_obj_val, zend_object *old_object, zend_object_handle handle TSRMLS_DC) { - if (EG(ze1_compatibility_mode)) { - zend_hash_copy(new_object->properties, old_object->properties, (copy_ctor_func_t) zval_add_ref_or_clone, (void *) NULL /* Not used anymore */, sizeof(zval *)); - } else { - zend_hash_copy(new_object->properties, old_object->properties, (copy_ctor_func_t) zval_add_ref, (void *) NULL /* Not used anymore */, sizeof(zval *)); - } + zend_hash_copy(new_object->properties, old_object->properties, (copy_ctor_func_t) zval_add_ref, (void *) NULL /* Not used anymore */, sizeof(zval *)); + if (old_object->ce->clone) { zval *new_obj; diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index 34736184c5..542af1576f 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -367,15 +367,8 @@ ZEND_API void convert_to_long_base(zval *op, int base) if (Z_TYPE_P(op) == IS_LONG) { return; } - - if (EG(ze1_compatibility_mode)) { - HashTable *ht = Z_OBJPROP_P(op); - if (ht) { - retval = (zend_hash_num_elements(ht)?1:0); - } - } else { - zend_error(E_NOTICE, "Object of class %s could not be converted to int", Z_OBJCE_P(op)->name); - } + zend_error(E_NOTICE, "Object of class %s could not be converted to int", Z_OBJCE_P(op)->name); + zval_dtor(op); ZVAL_LONG(op, retval); return; @@ -433,15 +426,7 @@ ZEND_API void convert_to_double(zval *op) if (Z_TYPE_P(op) == IS_DOUBLE) { return; } - - if (EG(ze1_compatibility_mode)) { - HashTable *ht = Z_OBJPROP_P(op); - if (ht) { - retval = (zend_hash_num_elements(ht)?1.0:0.0); - } - } else { - zend_error(E_NOTICE, "Object of class %s could not be converted to double", Z_OBJCE_P(op)->name); - } + zend_error(E_NOTICE, "Object of class %s could not be converted to double", Z_OBJCE_P(op)->name); zval_dtor(op); ZVAL_DOUBLE(op, retval); @@ -530,13 +515,6 @@ ZEND_API void convert_to_boolean(zval *op) return; } - if (EG(ze1_compatibility_mode)) { - HashTable *ht = Z_OBJPROP_P(op); - if (ht) { - retval = (zend_hash_num_elements(ht)?1:0); - } - } - zval_dtor(op); ZVAL_BOOL(op, retval); break; @@ -1565,15 +1543,7 @@ ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) break; case IS_OBJECT: if (Z_OBJ_HT_P(op1) == Z_OBJ_HT_P(op2)) { - if (EG(ze1_compatibility_mode)) { - zend_compare_objects(result, op1, op2 TSRMLS_CC); - /* comparison returns 0 in case of equality and - * 1 in case of ineqaulity, we need to reverse it - */ - Z_LVAL_P(result) = !Z_LVAL_P(result); - } else { - Z_LVAL_P(result) = (Z_OBJ_HANDLE_P(op1) == Z_OBJ_HANDLE_P(op2)); - } + Z_LVAL_P(result) = (Z_OBJ_HANDLE_P(op1) == Z_OBJ_HANDLE_P(op2)); } else { Z_LVAL_P(result) = 0; } diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index e7b09e4bcb..2d69256aa5 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -2322,25 +2322,7 @@ ZEND_VM_C_LABEL(return_by_value): retval_ptr = GET_OP1_ZVAL_PTR(BP_VAR_R); - if (EG(ze1_compatibility_mode) && Z_TYPE_P(retval_ptr) == IS_OBJECT) { - zval *ret; - char *class_name; - zend_uint class_name_len; - int dup; - - ALLOC_ZVAL(ret); - INIT_PZVAL_COPY(ret, retval_ptr); - dup = zend_get_object_classname(retval_ptr, &class_name, &class_name_len TSRMLS_CC); - if (Z_OBJ_HT_P(retval_ptr)->clone_obj == NULL) { - zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %s", class_name); - } - zend_error(E_STRICT, "Implicit cloning object of class '%s' because of 'zend.ze1_compatibility_mode'", class_name); - ret->value.obj = Z_OBJ_HT_P(retval_ptr)->clone_obj(retval_ptr TSRMLS_CC); - *EG(return_value_ptr_ptr) = ret; - if (!dup) { - efree(class_name); - } - } else if (!IS_OP1_TMP_FREE()) { /* Not a temp var */ + if (!IS_OP1_TMP_FREE()) { /* Not a temp var */ if (EG(active_op_array)->return_reference == ZEND_RETURN_REF || (PZVAL_IS_REF(retval_ptr) && Z_REFCOUNT_P(retval_ptr) > 0)) { zval *ret; diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 95bc66e9c8..f6c3f6359d 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -1432,25 +1432,7 @@ return_by_value: retval_ptr = &opline->op1.u.constant; - if (EG(ze1_compatibility_mode) && Z_TYPE_P(retval_ptr) == IS_OBJECT) { - zval *ret; - char *class_name; - zend_uint class_name_len; - int dup; - - ALLOC_ZVAL(ret); - INIT_PZVAL_COPY(ret, retval_ptr); - dup = zend_get_object_classname(retval_ptr, &class_name, &class_name_len TSRMLS_CC); - if (Z_OBJ_HT_P(retval_ptr)->clone_obj == NULL) { - zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %s", class_name); - } - zend_error(E_STRICT, "Implicit cloning object of class '%s' because of 'zend.ze1_compatibility_mode'", class_name); - ret->value.obj = Z_OBJ_HT_P(retval_ptr)->clone_obj(retval_ptr TSRMLS_CC); - *EG(return_value_ptr_ptr) = ret; - if (!dup) { - efree(class_name); - } - } else if (!0) { /* Not a temp var */ + if (!0) { /* Not a temp var */ if (EG(active_op_array)->return_reference == ZEND_RETURN_REF || (PZVAL_IS_REF(retval_ptr) && Z_REFCOUNT_P(retval_ptr) > 0)) { zval *ret; @@ -4608,25 +4590,7 @@ return_by_value: retval_ptr = _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (EG(ze1_compatibility_mode) && Z_TYPE_P(retval_ptr) == IS_OBJECT) { - zval *ret; - char *class_name; - zend_uint class_name_len; - int dup; - - ALLOC_ZVAL(ret); - INIT_PZVAL_COPY(ret, retval_ptr); - dup = zend_get_object_classname(retval_ptr, &class_name, &class_name_len TSRMLS_CC); - if (Z_OBJ_HT_P(retval_ptr)->clone_obj == NULL) { - zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %s", class_name); - } - zend_error(E_STRICT, "Implicit cloning object of class '%s' because of 'zend.ze1_compatibility_mode'", class_name); - ret->value.obj = Z_OBJ_HT_P(retval_ptr)->clone_obj(retval_ptr TSRMLS_CC); - *EG(return_value_ptr_ptr) = ret; - if (!dup) { - efree(class_name); - } - } else if (!1) { /* Not a temp var */ + if (!1) { /* Not a temp var */ if (EG(active_op_array)->return_reference == ZEND_RETURN_REF || (PZVAL_IS_REF(retval_ptr) && Z_REFCOUNT_P(retval_ptr) > 0)) { zval *ret; @@ -7719,25 +7683,7 @@ return_by_value: retval_ptr = _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (EG(ze1_compatibility_mode) && Z_TYPE_P(retval_ptr) == IS_OBJECT) { - zval *ret; - char *class_name; - zend_uint class_name_len; - int dup; - - ALLOC_ZVAL(ret); - INIT_PZVAL_COPY(ret, retval_ptr); - dup = zend_get_object_classname(retval_ptr, &class_name, &class_name_len TSRMLS_CC); - if (Z_OBJ_HT_P(retval_ptr)->clone_obj == NULL) { - zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %s", class_name); - } - zend_error(E_STRICT, "Implicit cloning object of class '%s' because of 'zend.ze1_compatibility_mode'", class_name); - ret->value.obj = Z_OBJ_HT_P(retval_ptr)->clone_obj(retval_ptr TSRMLS_CC); - *EG(return_value_ptr_ptr) = ret; - if (!dup) { - efree(class_name); - } - } else if (!0) { /* Not a temp var */ + if (!0) { /* Not a temp var */ if (EG(active_op_array)->return_reference == ZEND_RETURN_REF || (PZVAL_IS_REF(retval_ptr) && Z_REFCOUNT_P(retval_ptr) > 0)) { zval *ret; @@ -21409,25 +21355,7 @@ return_by_value: retval_ptr = _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC); - if (EG(ze1_compatibility_mode) && Z_TYPE_P(retval_ptr) == IS_OBJECT) { - zval *ret; - char *class_name; - zend_uint class_name_len; - int dup; - - ALLOC_ZVAL(ret); - INIT_PZVAL_COPY(ret, retval_ptr); - dup = zend_get_object_classname(retval_ptr, &class_name, &class_name_len TSRMLS_CC); - if (Z_OBJ_HT_P(retval_ptr)->clone_obj == NULL) { - zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %s", class_name); - } - zend_error(E_STRICT, "Implicit cloning object of class '%s' because of 'zend.ze1_compatibility_mode'", class_name); - ret->value.obj = Z_OBJ_HT_P(retval_ptr)->clone_obj(retval_ptr TSRMLS_CC); - *EG(return_value_ptr_ptr) = ret; - if (!dup) { - efree(class_name); - } - } else if (!0) { /* Not a temp var */ + if (!0) { /* Not a temp var */ if (EG(active_op_array)->return_reference == ZEND_RETURN_REF || (PZVAL_IS_REF(retval_ptr) && Z_REFCOUNT_P(retval_ptr) > 0)) { zval *ret; diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c index f854bafc72..eb7562a1b4 100644 --- a/ext/dom/php_dom.c +++ b/ext/dom/php_dom.c @@ -69,7 +69,6 @@ zend_class_entry *dom_xpath_class_entry; zend_class_entry *dom_namespace_node_class_entry; zend_object_handlers dom_object_handlers; -zend_object_handlers dom_ze1_object_handlers; static HashTable classes; @@ -504,25 +503,13 @@ zend_object_value dom_objects_store_clone_obj(zval *zobject TSRMLS_DC) return retval; } - -zend_object_value dom_objects_ze1_clone_obj(zval *zobject TSRMLS_DC) -{ - php_error(E_ERROR, "Cannot clone object of class %s due to 'zend.ze1_compatibility_mode'", Z_OBJCE_P(zobject)->name); - /* Return zobject->value.obj just to satisfy compiler */ - return zobject->value.obj; -} - static const zend_function_entry dom_functions[] = { PHP_FE(dom_import_simplexml, NULL) {NULL, NULL, NULL} }; static zend_object_handlers* dom_get_obj_handlers(TSRMLS_D) { - if (EG(ze1_compatibility_mode)) { - return &dom_ze1_object_handlers; - } else { - return &dom_object_handlers; - } + return &dom_object_handlers; } static const zend_module_dep dom_deps[] = { @@ -561,13 +548,6 @@ PHP_MINIT_FUNCTION(dom) dom_object_handlers.clone_obj = dom_objects_store_clone_obj; dom_object_handlers.has_property = dom_property_exists; - memcpy(&dom_ze1_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); - dom_ze1_object_handlers.read_property = dom_read_property; - dom_ze1_object_handlers.write_property = dom_write_property; - dom_ze1_object_handlers.get_property_ptr_ptr = dom_get_property_ptr_ptr; - dom_ze1_object_handlers.clone_obj = dom_objects_ze1_clone_obj; - dom_ze1_object_handlers.has_property = dom_property_exists; - zend_hash_init(&classes, 0, NULL, NULL, 1); INIT_CLASS_ENTRY(ce, "DOMException", php_dom_domexception_class_functions); diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c index f70efed368..3df38f2a00 100644 --- a/ext/simplexml/simplexml.c +++ b/ext/simplexml/simplexml.c @@ -1872,41 +1872,6 @@ static zend_object_handlers sxe_object_handlers = { /* {{{ */ }; /* }}} */ -static zend_object_handlers sxe_ze1_object_handlers = { /* {{{ */ - ZEND_OBJECTS_STORE_HANDLERS, - sxe_property_read, - sxe_property_write, - sxe_dimension_read, - sxe_dimension_write, - sxe_property_get_adr, - sxe_get_value, /* get */ - NULL, - sxe_property_exists, - sxe_property_delete, - sxe_dimension_exists, - sxe_dimension_delete, - sxe_get_properties, - NULL, /* zend_get_std_object_handlers()->get_method,*/ - NULL, /* zend_get_std_object_handlers()->call_method,*/ - NULL, /* zend_get_std_object_handlers()->get_constructor, */ - NULL, /* zend_get_std_object_handlers()->get_class_entry,*/ - NULL, /* zend_get_std_object_handlers()->get_class_name,*/ - sxe_objects_compare, - sxe_object_cast, - sxe_count_elements, - sxe_get_debug_info -}; -/* }}} */ - -static zend_object_value sxe_object_ze1_clone(zval *zobject TSRMLS_DC) /* {{{ */ -{ - php_error(E_ERROR, "Cannot clone object of class %s due to 'zend.ze1_compatibility_mode'", Z_OBJCE_P(zobject)->name); - /* Return zobject->value.obj just to satisfy compiler */ - /* FIXME: Should not be a fatal */ - return zobject->value.obj; -} -/* }}} */ - /* {{{ sxe_object_clone() */ static void @@ -2044,11 +2009,7 @@ php_sxe_register_object(php_sxe_object *intern TSRMLS_DC) zend_object_value rv; rv.handle = zend_objects_store_put(intern, sxe_object_dtor, (zend_objects_free_object_storage_t)sxe_object_free_storage, sxe_object_clone TSRMLS_CC); - if (EG(ze1_compatibility_mode)) { - rv.handlers = (zend_object_handlers *) &sxe_ze1_object_handlers; - } else { - rv.handlers = (zend_object_handlers *) &sxe_object_handlers; - } + rv.handlers = (zend_object_handlers *) &sxe_object_handlers; return rv; } @@ -2479,12 +2440,6 @@ PHP_MINIT_FUNCTION(simplexml) sxe_object_handlers.get_class_entry = zend_get_std_object_handlers()->get_class_entry; sxe_object_handlers.get_class_name = zend_get_std_object_handlers()->get_class_name; - sxe_ze1_object_handlers.get_method = zend_get_std_object_handlers()->get_method; - sxe_ze1_object_handlers.get_constructor = zend_get_std_object_handlers()->get_constructor; - sxe_ze1_object_handlers.get_class_entry = zend_get_std_object_handlers()->get_class_entry; - sxe_ze1_object_handlers.get_class_name = zend_get_std_object_handlers()->get_class_name; - sxe_ze1_object_handlers.clone_obj = sxe_object_ze1_clone; - #ifdef HAVE_SPL if (zend_get_module_started("spl") == SUCCESS) { PHP_MINIT(spl_sxe)(INIT_FUNC_ARGS_PASSTHRU); diff --git a/main/main.c b/main/main.c index 63e7bd1261..5b8e334ed8 100644 --- a/main/main.c +++ b/main/main.c @@ -1816,6 +1816,22 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod return FAILURE; } + /* Check for deprecated directives */ + { + static const char *directives[] = { + "zend.ze1_compatibility_mode", + NULL}; + const char **p = directives; + long val; + + while (*p) { + if (cfg_get_long((char*)*p, &val) == SUCCESS && val) { + zend_error(E_WARNING, "Directive '%s' is no longer supported in PHP 5.3 and greater", *p); + } + ++p; + } + } + /* Register PHP core ini entries */ REGISTER_INI_ENTRIES(); |