summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2006-03-16 10:33:23 +0000
committerDmitry Stogov <dmitry@php.net>2006-03-16 10:33:23 +0000
commit7c0e534157ebf552c0393471ecd41b04fce35e17 (patch)
treefbf73045089b3dcbfd36e1aa85ac7127c301fcf2
parent22055cb8fddf93085b518a5c21370c26c0a1cb2c (diff)
downloadphp-git-7c0e534157ebf552c0393471ecd41b04fce35e17.tar.gz
Dropped zend.ze1_compatibility_mode
-rw-r--r--NEWS1
-rw-r--r--Zend/tests/bug30332.phpt40
-rw-r--r--Zend/tests/bug31828.phpt25
-rw-r--r--Zend/tests/bug32080.phpt18
-rw-r--r--Zend/tests/bug32852.phpt38
-rwxr-xr-xZend/tests/bug33243.phpt38
-rwxr-xr-xZend/tests/bug34712.phpt28
-rwxr-xr-xZend/tests/bug34767.phpt33
-rw-r--r--Zend/zend.c1
-rw-r--r--Zend/zend_API.c19
-rw-r--r--Zend/zend_execute.c103
-rw-r--r--Zend/zend_execute.h9
-rw-r--r--Zend/zend_execute_API.c7
-rw-r--r--Zend/zend_globals.h1
-rw-r--r--Zend/zend_objects.c26
-rw-r--r--Zend/zend_operators.c36
-rw-r--r--Zend/zend_vm_def.h20
-rw-r--r--Zend/zend_vm_execute.h80
-rw-r--r--ext/dom/php_dom.c21
-rw-r--r--ext/simplexml/simplexml.c44
-rw-r--r--main/main.c1
-rw-r--r--tests/lang/bug22367.phpt131
22 files changed, 20 insertions, 700 deletions
diff --git a/NEWS b/NEWS
index 905b6ab408..b45a60d649 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ PHP NEWS
?? ??? ????, PHP 6.0
- Unicode support. (Andrei, Dmitry, et al)
- Dropped safe_mode support (Ilia, Andi)
+- Dropped zend.ze1_compatibility_mode (Dmitry)
- Dropped register_long_arrays (Dmitry)
- Droped register_globals support (Pierre)
- session_register, session_unregister and session_is_registered removed they
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 ec791af4cf..0000000000
--- a/Zend/tests/bug33243.phpt
+++ /dev/null
@@ -1,38 +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)
- }
-}
---UEXPECTF--
-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) {
- [u"y"]=>
- object(stdClass)#%d (1) {
- [u"z"]=>
- int(0)
- }
-}
diff --git a/Zend/tests/bug34712.phpt b/Zend/tests/bug34712.phpt
deleted file mode 100755
index db7860cd38..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 45af9f944c..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=4095
---FILE--
-<?php
-$a->y = &new stdClass();
-print_r($a);
-$b = $a;
-$a->y->z = 1;
-print_r($b);
-?>
---EXPECTF--
-
-Strict Standards: 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 5053ed22eb..4fdb34d2c9 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -210,7 +210,6 @@ static ZEND_INI_MH(OnUpdateConversionSubstChar)
ZEND_INI_BEGIN()
ZEND_INI_ENTRY("error_reporting", NULL, ZEND_INI_ALL, OnUpdateErrorReporting)
- STD_ZEND_INI_BOOLEAN("zend.ze1_compatibility_mode", "0", ZEND_INI_ALL, OnUpdateBool, ze1_compatibility_mode, zend_executor_globals, executor_globals)
/* Unicode .ini entries */
STD_ZEND_INI_BOOLEAN("unicode_semantics", "0", ZEND_INI_SYSTEM, OnUpdateBool, unicode, zend_unicode_globals, unicode_globals)
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index 0d7616d858..9b52cec9d4 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -154,25 +154,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) {
- zval *value_ptr;
- zstr 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 '%v' because of 'zend.ze1_compatibility_mode'", class_name.v);
- if(!dup) {
- efree(class_name.v);
- }
- Z_OBJVAL_P(value_ptr) = 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 fc1d169de3..2f7ab9553c 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -598,26 +598,7 @@ static inline void zend_assign_to_object(znode *result, zval **object_ptr, znode
/* here we are sure we are dealing with an object */
/* separate our value if necessary */
- if (EG(ze1_compatibility_mode) && Z_TYPE_P(value) == IS_OBJECT) {
- zval *orig_value = value;
- zstr class_name;
- zend_uint class_name_len;
- int dup;
-
- ALLOC_ZVAL(value);
- *value = *orig_value;
- value->is_ref = 0;
- value->refcount = 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 %v", class_name.v);
- }
- zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", class_name.v);
- Z_OBJVAL_P(value) = Z_OBJ_HANDLER_P(orig_value, clone_obj)(orig_value TSRMLS_CC);
- if (!dup) {
- efree(class_name.v);
- }
- } else if (value_op->op_type == IS_TMP_VAR) {
+ if (value_op->op_type == IS_TMP_VAR) {
zval *orig_value = value;
ALLOC_ZVAL(value);
@@ -807,60 +788,11 @@ static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2
}
if (Z_TYPE_P(variable_ptr) == IS_OBJECT && Z_OBJ_HANDLER_P(variable_ptr, set)) {
- /* TODO? ze1_compatibility_mode support */
Z_OBJ_HANDLER_P(variable_ptr, set)(variable_ptr_ptr, value TSRMLS_CC);
goto done_setting_var;
}
- if (EG(ze1_compatibility_mode) && Z_TYPE_P(value) == IS_OBJECT) {
- zstr 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 %v", class_name.v);
- } else if (PZVAL_IS_REF(variable_ptr)) {
- if (variable_ptr != value) {
- zend_uint refcount = variable_ptr->refcount;
- zval garbage;
-
- if (type != IS_TMP_VAR) {
- value->refcount++;
- }
- garbage = *variable_ptr;
- *variable_ptr = *value;
- variable_ptr->refcount = refcount;
- variable_ptr->is_ref = 1;
- zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", class_name.v);
- Z_OBJVAL_P(variable_ptr) = Z_OBJ_HANDLER_P(value, clone_obj)(value TSRMLS_CC);
- if (type != IS_TMP_VAR) {
- value->refcount--;
- }
- zendi_zval_dtor(garbage);
- }
- } else {
- if (variable_ptr != value) {
- value->refcount++;
- variable_ptr->refcount--;
- if (variable_ptr->refcount == 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 '%v' because of 'zend.ze1_compatibility_mode'", class_name.v);
- Z_OBJVAL_P(variable_ptr) = Z_OBJ_HANDLER_P(value, clone_obj)(value TSRMLS_CC);
- zval_ptr_dtor(&value);
- }
- }
- if (!dup) {
- efree(class_name.v);
- }
- } else if (PZVAL_IS_REF(variable_ptr)) {
+ if (PZVAL_IS_REF(variable_ptr)) {
if (variable_ptr!=value) {
zend_uint refcount = variable_ptr->refcount;
zval garbage;
@@ -950,34 +882,9 @@ done_setting_var:
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) {
- zstr 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 %v", class_name.v);
- } else {
- variable_ptr->refcount--;
- 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 '%v' because of 'zend.ze1_compatibility_mode'", class_name.v);
- Z_OBJVAL_P(variable_ptr) = Z_OBJ_HANDLER_P(value, clone_obj)(value TSRMLS_CC);
- }
- if (!dup) {
- efree(class_name.v);
- }
- } else {
- variable_ptr->refcount--;
- *variable_ptr_ptr = value;
- value->refcount++;
- }
+ (*variable_ptr_ptr)->refcount--;
+ *variable_ptr_ptr = value;
+ value->refcount++;
}
/* Utility Functions for Extensions */
diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h
index 006556a99c..74773f2036 100644
--- a/Zend/zend_execute.h
+++ b/Zend/zend_execute.h
@@ -132,15 +132,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 bd5643fe5b..6806556d00 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -412,13 +412,6 @@ ZEND_API void _zval_ptr_dtor(zval **zval_ptr ZEND_FILE_LINE_DC)
zval_dtor(*zval_ptr);
safe_free_zval_ptr_rel(*zval_ptr ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC);
} else if ((*zval_ptr)->refcount == 1) {
- if (Z_TYPE_PP(zval_ptr) == IS_OBJECT) {
- TSRMLS_FETCH();
-
- if (EG(ze1_compatibility_mode)) {
- return;
- }
- }
(*zval_ptr)->is_ref = 0;
}
}
diff --git a/Zend/zend_globals.h b/Zend/zend_globals.h
index 1de7535685..77cf007108 100644
--- a/Zend/zend_globals.h
+++ b/Zend/zend_globals.h
@@ -195,7 +195,6 @@ struct _zend_executor_globals {
zend_function *autoload_func;
zend_bool bailout_set;
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 1ce9caeae3..416e9cace3 100644
--- a/Zend/zend_objects.c
+++ b/Zend/zend_objects.c
@@ -114,33 +114,9 @@ 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 %v", Z_OBJCE_PP(p)->name);
- } else {
- zval *orig = *p;
-
- ALLOC_ZVAL(*p);
- **p = *orig;
- INIT_PZVAL(*p);
- Z_OBJVAL_PP(p) = Z_OBJ_HT_PP(p)->clone_obj(orig TSRMLS_CC);
- }
- } else {
- (*p)->refcount++;
- }
-}
-
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 337c241e32..33c5b5df94 100644
--- a/Zend/zend_operators.c
+++ b/Zend/zend_operators.c
@@ -394,14 +394,8 @@ ZEND_API void convert_to_long_base(zval *op, int base)
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 %v could not be converted to int", Z_OBJCE_P(op)->name);
- }
+ zend_error(E_NOTICE, "Object of class %v could not be converted to int", Z_OBJCE_P(op)->name);
+
zval_dtor(op);
ZVAL_LONG(op, retval);
return;
@@ -469,14 +463,7 @@ ZEND_API void convert_to_double(zval *op)
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 %v could not be converted to double", Z_OBJCE_P(op)->name);
- }
+ zend_error(E_NOTICE, "Object of class %v could not be converted to double", Z_OBJCE_P(op)->name);
zval_dtor(op);
ZVAL_DOUBLE(op, retval);
@@ -579,13 +566,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;
@@ -1708,15 +1688,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 e0333793fb..040f039ae2 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -2075,25 +2075,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;
- zstr 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 %v", class_name);
- }
- zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", class_name);
- Z_OBJVAL_P(ret) = Z_OBJ_HT_P(retval_ptr)->clone_obj(retval_ptr TSRMLS_CC);
- *EG(return_value_ptr_ptr) = ret;
- if (!dup) {
- efree(class_name.v);
- }
- } 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) && retval_ptr->refcount > 0)) {
zval *ret;
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index 2cc92ec212..cb2fdb732c 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -1652,25 +1652,7 @@ return_by_value:
retval_ptr = &opline->op1.u.constant;
- if (EG(ze1_compatibility_mode) && Z_TYPE_P(retval_ptr) == IS_OBJECT) {
- zval *ret;
- zstr 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 %v", class_name);
- }
- zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", class_name);
- Z_OBJVAL_P(ret) = Z_OBJ_HT_P(retval_ptr)->clone_obj(retval_ptr TSRMLS_CC);
- *EG(return_value_ptr_ptr) = ret;
- if (!dup) {
- efree(class_name.v);
- }
- } 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) && retval_ptr->refcount > 0)) {
zval *ret;
@@ -4145,25 +4127,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;
- zstr 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 %v", class_name);
- }
- zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", class_name);
- Z_OBJVAL_P(ret) = Z_OBJ_HT_P(retval_ptr)->clone_obj(retval_ptr TSRMLS_CC);
- *EG(return_value_ptr_ptr) = ret;
- if (!dup) {
- efree(class_name.v);
- }
- } 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) && retval_ptr->refcount > 0)) {
zval *ret;
@@ -7145,25 +7109,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;
- zstr 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 %v", class_name);
- }
- zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", class_name);
- Z_OBJVAL_P(ret) = Z_OBJ_HT_P(retval_ptr)->clone_obj(retval_ptr TSRMLS_CC);
- *EG(return_value_ptr_ptr) = ret;
- if (!dup) {
- efree(class_name.v);
- }
- } 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) && retval_ptr->refcount > 0)) {
zval *ret;
@@ -19787,25 +19733,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;
- zstr 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 %v", class_name);
- }
- zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", class_name);
- Z_OBJVAL_P(ret) = Z_OBJ_HT_P(retval_ptr)->clone_obj(retval_ptr TSRMLS_CC);
- *EG(return_value_ptr_ptr) = ret;
- if (!dup) {
- efree(class_name.v);
- }
- } 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) && retval_ptr->refcount > 0)) {
zval *ret;
diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c
index 607c2f7268..925b230fc0 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;
static HashTable u_classes;
@@ -467,24 +466,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 %v due to 'zend.ze1_compatibility_mode'", Z_OBJCE_P(zobject)->name);
- /* Return zobject->value.obj just to satisfy compiler */
- return zobject->value.obj;
-}
-
static 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 zend_module_dep dom_deps[] = {
@@ -562,13 +550,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_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, (void (*)(void *))dom_prop_handlers_dtor, 1);
INIT_CLASS_ENTRY(ce, "DOMException", php_dom_domexception_class_functions);
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c
index d8708e04b3..70182def08 100644
--- a/ext/simplexml/simplexml.c
+++ b/ext/simplexml/simplexml.c
@@ -1688,38 +1688,6 @@ static zend_object_handlers sxe_object_handlers = {
sxe_count_elements
};
-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_properties_get,
- 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
-};
-
-static zend_object_value sxe_object_ze1_clone(zval *zobject TSRMLS_DC)
-{
- php_error(E_ERROR, "Cannot clone object of class %v 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
@@ -1830,11 +1798,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;
}
@@ -2271,12 +2235,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 2e7fa27e1e..81f9a255a9 100644
--- a/main/main.c
+++ b/main/main.c
@@ -1578,6 +1578,7 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
"magic_quotes_gpc",
"magic_quotes_runtime",
"magic_quotes_sybase",
+ "zend.ze1_compatibility_mode",
NULL};
const char **p = directives;
long val;
diff --git a/tests/lang/bug22367.phpt b/tests/lang/bug22367.phpt
deleted file mode 100644
index 364472b464..0000000000
--- a/tests/lang/bug22367.phpt
+++ /dev/null
@@ -1,131 +0,0 @@
---TEST--
-Bug #22367 (weird zval allocation problem)
---INI--
-error_reporting=4095
-zend.ze1_compatibility_mode=1
---FILE--
-<?php
-
-class foo
-{
- public $test = array(0, 1, 2, 3, 4);
-
- function a($arg) {
- var_dump(array_key_exists($arg, $this->test));
- return $this->test[$arg];
- }
-
- function b() {
- @$this->c();
-
- $zero = $this->test[0];
- $one = $this->test[1];
- $two = $this->test[2];
- $three = $this->test[3];
- $four = $this->test[4];
- return array($zero, $one, $two, $three, $four);
- }
-
- function c() {
- return $this->a($this->d());
- }
-
- function d() {}
-}
-
-class bar extends foo
-{
- public $i = 0;
- public $idx;
-
- function bar($idx) {
- $this->idx = $idx;
- }
-
- function &a($arg){
- return parent::a($arg);
- }
- function d(){
- return $this->idx;
- }
-}
-
-$a = new bar(5);
-var_dump($a->idx);
-$a->c();
-$b = $a->b();
-var_dump($b);
-var_dump($a->test);
-
-$a = new bar(2);
-var_dump($a->idx);
-@$a->c();
-$b = $a->b();
-var_dump($b);
-var_dump($a->test);
-
-?>
---EXPECTF--
-Strict Standards: Declaration of bar::a() should be compatible with that of foo::a() in %sbug22367.php on line %d
-
-Strict Standards: Implicit cloning object of class 'bar' because of 'zend.ze1_compatibility_mode' in %sbug22367.php on line %d
-int(5)
-bool(false)
-
-Notice: Undefined offset: 5 in %sbug22367.php on line %d
-
-Notice: Only variable references should be returned by reference in %sbug22367.php on line %d
-bool(false)
-array(5) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
- [4]=>
- int(4)
-}
-array(5) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
- [4]=>
- int(4)
-}
-
-Strict Standards: Implicit cloning object of class 'bar' because of 'zend.ze1_compatibility_mode' in %sbug22367.php on line %d
-int(2)
-bool(true)
-bool(true)
-array(5) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
- [4]=>
- int(4)
-}
-array(5) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
- [4]=>
- int(4)
-}