1
0
mirror of https://github.com/php/php-src.git synced 2026-03-29 11:42:17 +02:00

Sync convert_to_null with VM cast behavior

Do not call cast_object, this is useless and we haven't been doing
it in the VM as of 7.0.
This commit is contained in:
Nikita Popov
2016-09-04 12:36:16 +02:00
parent bbe0cca221
commit bbdff7ea24
3 changed files with 0 additions and 83 deletions

View File

@@ -411,19 +411,6 @@ try_again:
ZEND_API void ZEND_FASTCALL convert_to_null(zval *op) /* {{{ */
{
if (Z_TYPE_P(op) == IS_OBJECT) {
if (Z_OBJ_HT_P(op)->cast_object) {
zval org;
ZVAL_COPY_VALUE(&org, op);
if (Z_OBJ_HT_P(op)->cast_object(&org, op, IS_NULL) == SUCCESS) {
zval_dtor(&org);
return;
}
ZVAL_COPY_VALUE(op, &org);
}
}
zval_ptr_dtor(op);
ZVAL_NULL(op);
}

View File

@@ -5278,20 +5278,6 @@ ZEND_VM_HANDLER(21, ZEND_CAST, CONST|TMP|VAR|CV, ANY, TYPE)
switch (opline->extended_value) {
case IS_NULL:
/* This code is taken from convert_to_null. However, it does not seems very useful,
* because a conversion to null always results in the same value. This could only
* be relevant if a cast_object handler for IS_NULL has some kind of side-effect. */
#if 0
if (OP1_TYPE == IS_VAR || OP1_TYPE == IS_CV) {
ZVAL_DEREF(expr);
}
if (Z_TYPE_P(expr) == IS_OBJECT && Z_OBJ_HT_P(expr)->cast_object) {
if (Z_OBJ_HT_P(expr)->cast_object(expr, result, IS_NULL) == SUCCESS) {
break;
}
}
#endif
ZVAL_NULL(result);
break;
case _IS_BOOL:

View File

@@ -3291,20 +3291,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CAST_SPEC_CONST_HANDLER(ZEND_O
switch (opline->extended_value) {
case IS_NULL:
/* This code is taken from convert_to_null. However, it does not seems very useful,
* because a conversion to null always results in the same value. This could only
* be relevant if a cast_object handler for IS_NULL has some kind of side-effect. */
#if 0
if (IS_CONST == IS_VAR || IS_CONST == IS_CV) {
ZVAL_DEREF(expr);
}
if (Z_TYPE_P(expr) == IS_OBJECT && Z_OBJ_HT_P(expr)->cast_object) {
if (Z_OBJ_HT_P(expr)->cast_object(expr, result, IS_NULL) == SUCCESS) {
break;
}
}
#endif
ZVAL_NULL(result);
break;
case _IS_BOOL:
@@ -12416,20 +12402,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CAST_SPEC_TMP_HANDLER(ZEND_OPC
switch (opline->extended_value) {
case IS_NULL:
/* This code is taken from convert_to_null. However, it does not seems very useful,
* because a conversion to null always results in the same value. This could only
* be relevant if a cast_object handler for IS_NULL has some kind of side-effect. */
#if 0
if (IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) {
ZVAL_DEREF(expr);
}
if (Z_TYPE_P(expr) == IS_OBJECT && Z_OBJ_HT_P(expr)->cast_object) {
if (Z_OBJ_HT_P(expr)->cast_object(expr, result, IS_NULL) == SUCCESS) {
break;
}
}
#endif
ZVAL_NULL(result);
break;
case _IS_BOOL:
@@ -15982,20 +15954,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CAST_SPEC_VAR_HANDLER(ZEND_OPC
switch (opline->extended_value) {
case IS_NULL:
/* This code is taken from convert_to_null. However, it does not seems very useful,
* because a conversion to null always results in the same value. This could only
* be relevant if a cast_object handler for IS_NULL has some kind of side-effect. */
#if 0
if (IS_VAR == IS_VAR || IS_VAR == IS_CV) {
ZVAL_DEREF(expr);
}
if (Z_TYPE_P(expr) == IS_OBJECT && Z_OBJ_HT_P(expr)->cast_object) {
if (Z_OBJ_HT_P(expr)->cast_object(expr, result, IS_NULL) == SUCCESS) {
break;
}
}
#endif
ZVAL_NULL(result);
break;
case _IS_BOOL:
@@ -35015,20 +34973,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CAST_SPEC_CV_HANDLER(ZEND_OPCO
switch (opline->extended_value) {
case IS_NULL:
/* This code is taken from convert_to_null. However, it does not seems very useful,
* because a conversion to null always results in the same value. This could only
* be relevant if a cast_object handler for IS_NULL has some kind of side-effect. */
#if 0
if (IS_CV == IS_VAR || IS_CV == IS_CV) {
ZVAL_DEREF(expr);
}
if (Z_TYPE_P(expr) == IS_OBJECT && Z_OBJ_HT_P(expr)->cast_object) {
if (Z_OBJ_HT_P(expr)->cast_object(expr, result, IS_NULL) == SUCCESS) {
break;
}
}
#endif
ZVAL_NULL(result);
break;
case _IS_BOOL: