summaryrefslogtreecommitdiff
path: root/Zend/zend_operators.c
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-05-29 11:52:55 +0200
committerNikita Popov <nikita.ppv@gmail.com>2019-05-29 17:15:19 +0200
commit45a0656e9589eff0908067aba5a18026eec51231 (patch)
tree749cc6a5ed1a94c00af05f7502c2be10248deeed /Zend/zend_operators.c
parent693955c5c534ac6ef7a3785e9731a1e9f6e3c2fa (diff)
downloadphp-git-45a0656e9589eff0908067aba5a18026eec51231.tar.gz
Remove get() object handler
Now that set() is gone, there is little point in keeping get(), as it is essentially just a different way of writing cast_object() now. Closes GH-4202.
Diffstat (limited to 'Zend/zend_operators.c')
-rw-r--r--Zend/zend_operators.c45
1 files changed, 3 insertions, 42 deletions
diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c
index 5b134e46b7..9cf0dcd22f 100644
--- a/Zend/zend_operators.c
+++ b/Zend/zend_operators.c
@@ -143,13 +143,6 @@ ZEND_API zend_long ZEND_FASTCALL zend_atol(const char *str, size_t str_len) /* {
"Object of class %s could not be converted to %s", ZSTR_VAL(Z_OBJCE_P(op)->name),\
zend_get_type_by_const(ctype)); \
} \
- } else if (Z_OBJ_HT_P(op)->get) { \
- zval *newop = Z_OBJ_HT_P(op)->get(Z_OBJ_P(op), dst); \
- if (Z_TYPE_P(newop) != IS_OBJECT) { \
- /* for safety - avoid loop */ \
- ZVAL_COPY_VALUE(dst, newop); \
- conv_func(dst); \
- } \
}
/* }}} */
@@ -866,14 +859,6 @@ try_again:
if (Z_OBJ_HT_P(op)->cast_object(Z_OBJ_P(op), &tmp, IS_STRING) == SUCCESS) {
return Z_STR(tmp);
}
- } else if (Z_OBJ_HT_P(op)->get) {
- zval *z = Z_OBJ_HT_P(op)->get(Z_OBJ_P(op), &tmp);
- if (Z_TYPE_P(z) != IS_OBJECT) {
- zend_string *str = zval_get_string(z);
- zval_ptr_dtor(z);
- return str;
- }
- zval_ptr_dtor(z);
}
zend_error(EG(exception) ? E_ERROR : E_RECOVERABLE_ERROR, "Object of class %s could not be converted to string", ZSTR_VAL(Z_OBJCE_P(op)->name));
return ZSTR_EMPTY_ALLOC();
@@ -1969,8 +1954,7 @@ ZEND_API int ZEND_FASTCALL compare_function(zval *result, zval *op1, zval *op2)
{
int ret;
int converted = 0;
- zval op1_copy, op2_copy;
- zval *op_free, tmp_free;
+ zval op1_copy, op2_copy, tmp_free;
while (1) {
switch (TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2))) {
@@ -2076,13 +2060,7 @@ ZEND_API int ZEND_FASTCALL compare_function(zval *result, zval *op1, zval *op2)
}
}
if (Z_TYPE_P(op1) == IS_OBJECT) {
- if (Z_OBJ_HT_P(op1)->get) {
- zval rv;
- op_free = Z_OBJ_HT_P(op1)->get(Z_OBJ_P(op1), &rv);
- ret = compare_function(result, op_free, op2);
- zend_free_obj_get_result(op_free);
- return ret;
- } else if (Z_TYPE_P(op2) != IS_OBJECT && Z_OBJ_HT_P(op1)->cast_object) {
+ if (Z_TYPE_P(op2) != IS_OBJECT && Z_OBJ_HT_P(op1)->cast_object) {
ZVAL_UNDEF(&tmp_free);
if (Z_OBJ_HT_P(op1)->cast_object(Z_OBJ_P(op1), &tmp_free, ((Z_TYPE_P(op2) == IS_FALSE || Z_TYPE_P(op2) == IS_TRUE) ? _IS_BOOL : Z_TYPE_P(op2))) == FAILURE) {
ZVAL_LONG(result, 1);
@@ -2095,13 +2073,7 @@ ZEND_API int ZEND_FASTCALL compare_function(zval *result, zval *op1, zval *op2)
}
}
if (Z_TYPE_P(op2) == IS_OBJECT) {
- if (Z_OBJ_HT_P(op2)->get) {
- zval rv;
- op_free = Z_OBJ_HT_P(op2)->get(Z_OBJ_P(op2), &rv);
- ret = compare_function(result, op1, op_free);
- zend_free_obj_get_result(op_free);
- return ret;
- } else if (Z_TYPE_P(op1) != IS_OBJECT && Z_OBJ_HT_P(op2)->cast_object) {
+ if (Z_TYPE_P(op1) != IS_OBJECT && Z_OBJ_HT_P(op2)->cast_object) {
ZVAL_UNDEF(&tmp_free);
if (Z_OBJ_HT_P(op2)->cast_object(Z_OBJ_P(op2), &tmp_free, ((Z_TYPE_P(op1) == IS_FALSE || Z_TYPE_P(op1) == IS_TRUE) ? _IS_BOOL : Z_TYPE_P(op1))) == FAILURE) {
ZVAL_LONG(result, -1);
@@ -2549,17 +2521,6 @@ ZEND_API int ZEND_FASTCALL zend_object_is_true(zval *op) /* {{{ */
return Z_TYPE(tmp) == IS_TRUE;
}
zend_error(E_RECOVERABLE_ERROR, "Object of class %s could not be converted to bool", ZSTR_VAL(zobj->ce->name));
- } else if (zobj->handlers->get) {
- int result;
- zval rv;
- zval *tmp = zobj->handlers->get(zobj, &rv);
-
- if (Z_TYPE_P(tmp) != IS_OBJECT) {
- /* for safety - avoid loop */
- result = i_zend_is_true(tmp);
- zval_ptr_dtor(tmp);
- return result;
- }
}
return 1;
}