mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Merge branch 'array_keys_strict_refs' of https://github.com/tony2001/php-src
This commit is contained in:
parent
881c502520
commit
a6be0f3fd6
8 changed files with 356 additions and 84 deletions
|
@ -1959,52 +1959,24 @@ ZEND_API int ZEND_FASTCALL compare_function(zval *result, zval *op1, zval *op2)
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
static int hash_zval_identical_function(zval *z1, zval *z2) /* {{{ */
|
|
||||||
{
|
|
||||||
zval result;
|
|
||||||
|
|
||||||
/* is_identical_function() returns 1 in case of identity and 0 in case
|
|
||||||
* of a difference;
|
|
||||||
* whereas this comparison function is expected to return 0 on identity,
|
|
||||||
* and non zero otherwise.
|
|
||||||
*/
|
|
||||||
ZVAL_DEREF(z1);
|
|
||||||
ZVAL_DEREF(z2);
|
|
||||||
if (is_identical_function(&result, z1, z2)==FAILURE) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return Z_TYPE(result) != IS_TRUE;
|
|
||||||
}
|
|
||||||
/* }}} */
|
|
||||||
|
|
||||||
ZEND_API int ZEND_FASTCALL zend_is_identical(zval *op1, zval *op2) /* {{{ */
|
ZEND_API int ZEND_FASTCALL zend_is_identical(zval *op1, zval *op2) /* {{{ */
|
||||||
{
|
{
|
||||||
if (Z_TYPE_P(op1) != Z_TYPE_P(op2)) {
|
if (Z_TYPE_P(op1) != Z_TYPE_P(op2)) {
|
||||||
return 0;
|
if (EXPECTED(Z_TYPE_P(op2) != IS_REFERENCE)) {
|
||||||
}
|
if (EXPECTED(Z_TYPE_P(op1) != IS_REFERENCE)) {
|
||||||
switch (Z_TYPE_P(op1)) {
|
return 0;
|
||||||
case IS_NULL:
|
} else {
|
||||||
case IS_FALSE:
|
op1 = Z_REFVAL_P(op1);
|
||||||
case IS_TRUE:
|
}
|
||||||
return 1;
|
} else {
|
||||||
case IS_LONG:
|
op2 = Z_REFVAL_P(op2);
|
||||||
return (Z_LVAL_P(op1) == Z_LVAL_P(op2));
|
}
|
||||||
case IS_RESOURCE:
|
if (Z_TYPE_P(op1) != Z_TYPE_P(op2)) {
|
||||||
return (Z_RES_P(op1) == Z_RES_P(op2));
|
|
||||||
case IS_DOUBLE:
|
|
||||||
return (Z_DVAL_P(op1) == Z_DVAL_P(op2));
|
|
||||||
case IS_STRING:
|
|
||||||
return (Z_STR_P(op1) == Z_STR_P(op2) ||
|
|
||||||
(Z_STRLEN_P(op1) == Z_STRLEN_P(op2) &&
|
|
||||||
memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0));
|
|
||||||
case IS_ARRAY:
|
|
||||||
return (Z_ARRVAL_P(op1) == Z_ARRVAL_P(op2) ||
|
|
||||||
zend_hash_compare(Z_ARRVAL_P(op1), Z_ARRVAL_P(op2), (compare_func_t) hash_zval_identical_function, 1) == 0);
|
|
||||||
case IS_OBJECT:
|
|
||||||
return (Z_OBJ_P(op1) == Z_OBJ_P(op2) && Z_OBJ_HT_P(op1) == Z_OBJ_HT_P(op2));
|
|
||||||
default:
|
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return zend_is_same_type_identical(op1, op2);
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
|
|
|
@ -729,24 +729,86 @@ static zend_always_inline int fast_equal_check_string(zval *op1, zval *op2)
|
||||||
return Z_LVAL(result) == 0;
|
return Z_LVAL(result) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int hash_zval_identical_function(zval *op1, zval *op2);
|
||||||
|
|
||||||
|
static inline int zend_is_same_type_identical(zval *op1, zval *op2)
|
||||||
|
{
|
||||||
|
switch (Z_TYPE_P(op1)) {
|
||||||
|
case IS_NULL:
|
||||||
|
case IS_FALSE:
|
||||||
|
case IS_TRUE:
|
||||||
|
return 1;
|
||||||
|
case IS_LONG:
|
||||||
|
return (Z_LVAL_P(op1) == Z_LVAL_P(op2));
|
||||||
|
case IS_RESOURCE:
|
||||||
|
return (Z_RES_P(op1) == Z_RES_P(op2));
|
||||||
|
case IS_DOUBLE:
|
||||||
|
return (Z_DVAL_P(op1) == Z_DVAL_P(op2));
|
||||||
|
case IS_STRING:
|
||||||
|
return (Z_STR_P(op1) == Z_STR_P(op2) ||
|
||||||
|
(Z_STRLEN_P(op1) == Z_STRLEN_P(op2) &&
|
||||||
|
memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0));
|
||||||
|
case IS_ARRAY:
|
||||||
|
return (Z_ARRVAL_P(op1) == Z_ARRVAL_P(op2) ||
|
||||||
|
zend_hash_compare(Z_ARRVAL_P(op1), Z_ARRVAL_P(op2), (compare_func_t) hash_zval_identical_function, 1) == 0);
|
||||||
|
case IS_OBJECT:
|
||||||
|
return (Z_OBJ_P(op1) == Z_OBJ_P(op2) && Z_OBJ_HT_P(op1) == Z_OBJ_HT_P(op2));
|
||||||
|
case IS_REFERENCE:
|
||||||
|
return zend_is_identical(Z_REFVAL_P(op1), Z_REFVAL_P(op2));
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static zend_always_inline int fast_is_identical_function(zval *op1, zval *op2)
|
static zend_always_inline int fast_is_identical_function(zval *op1, zval *op2)
|
||||||
{
|
{
|
||||||
if (Z_TYPE_P(op1) != Z_TYPE_P(op2)) {
|
if (Z_TYPE_P(op1) != Z_TYPE_P(op2)) {
|
||||||
return 0;
|
if (EXPECTED(Z_TYPE_P(op1) != IS_REFERENCE)) {
|
||||||
} else if (Z_TYPE_P(op1) <= IS_TRUE) {
|
if (EXPECTED(Z_TYPE_P(op2) != IS_REFERENCE)) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
op2 = Z_REFVAL_P(op2);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
op1 = Z_REFVAL_P(op1);
|
||||||
|
}
|
||||||
|
if (Z_TYPE_P(op1) != Z_TYPE_P(op2)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Z_TYPE_P(op1) <= IS_TRUE) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return zend_is_identical(op1, op2);
|
return zend_is_same_type_identical(op1, op2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static zend_always_inline int fast_is_not_identical_function(zval *op1, zval *op2)
|
static zend_always_inline int fast_is_not_identical_function(zval *op1, zval *op2)
|
||||||
{
|
{
|
||||||
if (Z_TYPE_P(op1) != Z_TYPE_P(op2)) {
|
if (Z_TYPE_P(op1) != Z_TYPE_P(op2)) {
|
||||||
return 1;
|
if (EXPECTED(Z_TYPE_P(op1) != IS_REFERENCE)) {
|
||||||
} else if (Z_TYPE_P(op1) <= IS_TRUE) {
|
if (EXPECTED(Z_TYPE_P(op2) != IS_REFERENCE)) {
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
op2 = Z_REFVAL_P(op2);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
op1 = Z_REFVAL_P(op1);
|
||||||
|
}
|
||||||
|
if (Z_TYPE_P(op1) != Z_TYPE_P(op2)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Z_TYPE_P(op1) <= IS_TRUE) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return !zend_is_identical(op1, op2);
|
return !zend_is_same_type_identical(op1, op2);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int hash_zval_identical_function(zval *op1, zval *op2)
|
||||||
|
{
|
||||||
|
return !fast_is_identical_function(op1, op2);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define ZEND_TRY_BINARY_OP1_OBJECT_OPERATION(opcode, binary_op) \
|
#define ZEND_TRY_BINARY_OP1_OBJECT_OPERATION(opcode, binary_op) \
|
||||||
|
|
|
@ -323,8 +323,8 @@ ZEND_VM_HANDLER(15, ZEND_IS_IDENTICAL, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
SAVE_OPLINE();
|
SAVE_OPLINE();
|
||||||
op1 = GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R);
|
op1 = GET_OP1_ZVAL_PTR(BP_VAR_R);
|
||||||
op2 = GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R);
|
op2 = GET_OP2_ZVAL_PTR(BP_VAR_R);
|
||||||
result = fast_is_identical_function(op1, op2);
|
result = fast_is_identical_function(op1, op2);
|
||||||
FREE_OP1();
|
FREE_OP1();
|
||||||
FREE_OP2();
|
FREE_OP2();
|
||||||
|
@ -344,8 +344,8 @@ ZEND_VM_HANDLER(16, ZEND_IS_NOT_IDENTICAL, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
SAVE_OPLINE();
|
SAVE_OPLINE();
|
||||||
op1 = GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R);
|
op1 = GET_OP1_ZVAL_PTR(BP_VAR_R);
|
||||||
op2 = GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R);
|
op2 = GET_OP2_ZVAL_PTR(BP_VAR_R);
|
||||||
result = fast_is_not_identical_function(op1, op2);
|
result = fast_is_not_identical_function(op1, op2);
|
||||||
FREE_OP1();
|
FREE_OP1();
|
||||||
FREE_OP2();
|
FREE_OP2();
|
||||||
|
|
|
@ -6824,7 +6824,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_CONST_VAR_HA
|
||||||
|
|
||||||
SAVE_OPLINE();
|
SAVE_OPLINE();
|
||||||
op1 = EX_CONSTANT(opline->op1);
|
op1 = EX_CONSTANT(opline->op1);
|
||||||
op2 = _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2);
|
op2 = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2);
|
||||||
result = fast_is_identical_function(op1, op2);
|
result = fast_is_identical_function(op1, op2);
|
||||||
|
|
||||||
zval_ptr_dtor_nogc(free_op2);
|
zval_ptr_dtor_nogc(free_op2);
|
||||||
|
@ -6845,7 +6845,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_CONST_VA
|
||||||
|
|
||||||
SAVE_OPLINE();
|
SAVE_OPLINE();
|
||||||
op1 = EX_CONSTANT(opline->op1);
|
op1 = EX_CONSTANT(opline->op1);
|
||||||
op2 = _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2);
|
op2 = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2);
|
||||||
result = fast_is_not_identical_function(op1, op2);
|
result = fast_is_not_identical_function(op1, op2);
|
||||||
|
|
||||||
zval_ptr_dtor_nogc(free_op2);
|
zval_ptr_dtor_nogc(free_op2);
|
||||||
|
@ -8533,7 +8533,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_CONST_CV_HAN
|
||||||
|
|
||||||
SAVE_OPLINE();
|
SAVE_OPLINE();
|
||||||
op1 = EX_CONSTANT(opline->op1);
|
op1 = EX_CONSTANT(opline->op1);
|
||||||
op2 = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var);
|
op2 = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var);
|
||||||
result = fast_is_identical_function(op1, op2);
|
result = fast_is_identical_function(op1, op2);
|
||||||
|
|
||||||
|
|
||||||
|
@ -8554,7 +8554,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_CONST_CV
|
||||||
|
|
||||||
SAVE_OPLINE();
|
SAVE_OPLINE();
|
||||||
op1 = EX_CONSTANT(opline->op1);
|
op1 = EX_CONSTANT(opline->op1);
|
||||||
op2 = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var);
|
op2 = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var);
|
||||||
result = fast_is_not_identical_function(op1, op2);
|
result = fast_is_not_identical_function(op1, op2);
|
||||||
|
|
||||||
|
|
||||||
|
@ -13304,7 +13304,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_TMP_VAR_HAND
|
||||||
|
|
||||||
SAVE_OPLINE();
|
SAVE_OPLINE();
|
||||||
op1 = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1);
|
op1 = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1);
|
||||||
op2 = _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2);
|
op2 = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2);
|
||||||
result = fast_is_identical_function(op1, op2);
|
result = fast_is_identical_function(op1, op2);
|
||||||
zval_ptr_dtor_nogc(free_op1);
|
zval_ptr_dtor_nogc(free_op1);
|
||||||
zval_ptr_dtor_nogc(free_op2);
|
zval_ptr_dtor_nogc(free_op2);
|
||||||
|
@ -13325,7 +13325,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_TMP_VAR_
|
||||||
|
|
||||||
SAVE_OPLINE();
|
SAVE_OPLINE();
|
||||||
op1 = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1);
|
op1 = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1);
|
||||||
op2 = _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2);
|
op2 = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2);
|
||||||
result = fast_is_not_identical_function(op1, op2);
|
result = fast_is_not_identical_function(op1, op2);
|
||||||
zval_ptr_dtor_nogc(free_op1);
|
zval_ptr_dtor_nogc(free_op1);
|
||||||
zval_ptr_dtor_nogc(free_op2);
|
zval_ptr_dtor_nogc(free_op2);
|
||||||
|
@ -13857,7 +13857,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_TMP_CV_HANDL
|
||||||
|
|
||||||
SAVE_OPLINE();
|
SAVE_OPLINE();
|
||||||
op1 = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1);
|
op1 = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1);
|
||||||
op2 = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var);
|
op2 = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var);
|
||||||
result = fast_is_identical_function(op1, op2);
|
result = fast_is_identical_function(op1, op2);
|
||||||
zval_ptr_dtor_nogc(free_op1);
|
zval_ptr_dtor_nogc(free_op1);
|
||||||
|
|
||||||
|
@ -13878,7 +13878,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_TMP_CV_H
|
||||||
|
|
||||||
SAVE_OPLINE();
|
SAVE_OPLINE();
|
||||||
op1 = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1);
|
op1 = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1);
|
||||||
op2 = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var);
|
op2 = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var);
|
||||||
result = fast_is_not_identical_function(op1, op2);
|
result = fast_is_not_identical_function(op1, op2);
|
||||||
zval_ptr_dtor_nogc(free_op1);
|
zval_ptr_dtor_nogc(free_op1);
|
||||||
|
|
||||||
|
@ -16406,7 +16406,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_VAR_CONST_HA
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
SAVE_OPLINE();
|
SAVE_OPLINE();
|
||||||
op1 = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1);
|
op1 = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1);
|
||||||
op2 = EX_CONSTANT(opline->op2);
|
op2 = EX_CONSTANT(opline->op2);
|
||||||
result = fast_is_identical_function(op1, op2);
|
result = fast_is_identical_function(op1, op2);
|
||||||
zval_ptr_dtor_nogc(free_op1);
|
zval_ptr_dtor_nogc(free_op1);
|
||||||
|
@ -16427,7 +16427,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_VAR_CONS
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
SAVE_OPLINE();
|
SAVE_OPLINE();
|
||||||
op1 = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1);
|
op1 = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1);
|
||||||
op2 = EX_CONSTANT(opline->op2);
|
op2 = EX_CONSTANT(opline->op2);
|
||||||
result = fast_is_not_identical_function(op1, op2);
|
result = fast_is_not_identical_function(op1, op2);
|
||||||
zval_ptr_dtor_nogc(free_op1);
|
zval_ptr_dtor_nogc(free_op1);
|
||||||
|
@ -18148,7 +18148,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_VAR_TMP_HAND
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
SAVE_OPLINE();
|
SAVE_OPLINE();
|
||||||
op1 = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1);
|
op1 = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1);
|
||||||
op2 = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2);
|
op2 = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2);
|
||||||
result = fast_is_identical_function(op1, op2);
|
result = fast_is_identical_function(op1, op2);
|
||||||
zval_ptr_dtor_nogc(free_op1);
|
zval_ptr_dtor_nogc(free_op1);
|
||||||
|
@ -18169,7 +18169,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_VAR_TMP_
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
SAVE_OPLINE();
|
SAVE_OPLINE();
|
||||||
op1 = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1);
|
op1 = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1);
|
||||||
op2 = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2);
|
op2 = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2);
|
||||||
result = fast_is_not_identical_function(op1, op2);
|
result = fast_is_not_identical_function(op1, op2);
|
||||||
zval_ptr_dtor_nogc(free_op1);
|
zval_ptr_dtor_nogc(free_op1);
|
||||||
|
@ -18360,8 +18360,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_VAR_VAR_HAND
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
SAVE_OPLINE();
|
SAVE_OPLINE();
|
||||||
op1 = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1);
|
op1 = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1);
|
||||||
op2 = _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2);
|
op2 = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2);
|
||||||
result = fast_is_identical_function(op1, op2);
|
result = fast_is_identical_function(op1, op2);
|
||||||
zval_ptr_dtor_nogc(free_op1);
|
zval_ptr_dtor_nogc(free_op1);
|
||||||
zval_ptr_dtor_nogc(free_op2);
|
zval_ptr_dtor_nogc(free_op2);
|
||||||
|
@ -18381,8 +18381,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_VAR_VAR_
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
SAVE_OPLINE();
|
SAVE_OPLINE();
|
||||||
op1 = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1);
|
op1 = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1);
|
||||||
op2 = _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2);
|
op2 = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2);
|
||||||
result = fast_is_not_identical_function(op1, op2);
|
result = fast_is_not_identical_function(op1, op2);
|
||||||
zval_ptr_dtor_nogc(free_op1);
|
zval_ptr_dtor_nogc(free_op1);
|
||||||
zval_ptr_dtor_nogc(free_op2);
|
zval_ptr_dtor_nogc(free_op2);
|
||||||
|
@ -19614,8 +19614,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_VAR_CV_HANDL
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
SAVE_OPLINE();
|
SAVE_OPLINE();
|
||||||
op1 = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1);
|
op1 = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1);
|
||||||
op2 = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var);
|
op2 = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var);
|
||||||
result = fast_is_identical_function(op1, op2);
|
result = fast_is_identical_function(op1, op2);
|
||||||
zval_ptr_dtor_nogc(free_op1);
|
zval_ptr_dtor_nogc(free_op1);
|
||||||
|
|
||||||
|
@ -19635,8 +19635,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_VAR_CV_H
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
SAVE_OPLINE();
|
SAVE_OPLINE();
|
||||||
op1 = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1);
|
op1 = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1);
|
||||||
op2 = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var);
|
op2 = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var);
|
||||||
result = fast_is_not_identical_function(op1, op2);
|
result = fast_is_not_identical_function(op1, op2);
|
||||||
zval_ptr_dtor_nogc(free_op1);
|
zval_ptr_dtor_nogc(free_op1);
|
||||||
|
|
||||||
|
@ -30092,7 +30092,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_CV_CONST_HAN
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
SAVE_OPLINE();
|
SAVE_OPLINE();
|
||||||
op1 = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var);
|
op1 = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var);
|
||||||
op2 = EX_CONSTANT(opline->op2);
|
op2 = EX_CONSTANT(opline->op2);
|
||||||
result = fast_is_identical_function(op1, op2);
|
result = fast_is_identical_function(op1, op2);
|
||||||
|
|
||||||
|
@ -30113,7 +30113,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_CV_CONST
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
SAVE_OPLINE();
|
SAVE_OPLINE();
|
||||||
op1 = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var);
|
op1 = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var);
|
||||||
op2 = EX_CONSTANT(opline->op2);
|
op2 = EX_CONSTANT(opline->op2);
|
||||||
result = fast_is_not_identical_function(op1, op2);
|
result = fast_is_not_identical_function(op1, op2);
|
||||||
|
|
||||||
|
@ -32972,7 +32972,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_CV_TMP_HANDL
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
SAVE_OPLINE();
|
SAVE_OPLINE();
|
||||||
op1 = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var);
|
op1 = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var);
|
||||||
op2 = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2);
|
op2 = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2);
|
||||||
result = fast_is_identical_function(op1, op2);
|
result = fast_is_identical_function(op1, op2);
|
||||||
|
|
||||||
|
@ -32993,7 +32993,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_CV_TMP_H
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
SAVE_OPLINE();
|
SAVE_OPLINE();
|
||||||
op1 = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var);
|
op1 = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var);
|
||||||
op2 = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2);
|
op2 = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2);
|
||||||
result = fast_is_not_identical_function(op1, op2);
|
result = fast_is_not_identical_function(op1, op2);
|
||||||
|
|
||||||
|
@ -33183,8 +33183,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_CV_VAR_HANDL
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
SAVE_OPLINE();
|
SAVE_OPLINE();
|
||||||
op1 = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var);
|
op1 = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var);
|
||||||
op2 = _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2);
|
op2 = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2);
|
||||||
result = fast_is_identical_function(op1, op2);
|
result = fast_is_identical_function(op1, op2);
|
||||||
|
|
||||||
zval_ptr_dtor_nogc(free_op2);
|
zval_ptr_dtor_nogc(free_op2);
|
||||||
|
@ -33204,8 +33204,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_CV_VAR_H
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
SAVE_OPLINE();
|
SAVE_OPLINE();
|
||||||
op1 = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var);
|
op1 = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var);
|
||||||
op2 = _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2);
|
op2 = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2);
|
||||||
result = fast_is_not_identical_function(op1, op2);
|
result = fast_is_not_identical_function(op1, op2);
|
||||||
|
|
||||||
zval_ptr_dtor_nogc(free_op2);
|
zval_ptr_dtor_nogc(free_op2);
|
||||||
|
@ -35327,8 +35327,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_CV_CV_HANDLE
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
SAVE_OPLINE();
|
SAVE_OPLINE();
|
||||||
op1 = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var);
|
op1 = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var);
|
||||||
op2 = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var);
|
op2 = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var);
|
||||||
result = fast_is_identical_function(op1, op2);
|
result = fast_is_identical_function(op1, op2);
|
||||||
|
|
||||||
|
|
||||||
|
@ -35348,8 +35348,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_CV_CV_HA
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
SAVE_OPLINE();
|
SAVE_OPLINE();
|
||||||
op1 = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var);
|
op1 = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var);
|
||||||
op2 = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var);
|
op2 = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var);
|
||||||
result = fast_is_not_identical_function(op1, op2);
|
result = fast_is_not_identical_function(op1, op2);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1613,7 +1613,6 @@ static inline void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior)
|
||||||
|
|
||||||
if (strict) {
|
if (strict) {
|
||||||
ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(array), num_idx, str_idx, entry) {
|
ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(array), num_idx, str_idx, entry) {
|
||||||
ZVAL_DEREF(entry);
|
|
||||||
if (fast_is_identical_function(value, entry)) {
|
if (fast_is_identical_function(value, entry)) {
|
||||||
if (behavior == 0) {
|
if (behavior == 0) {
|
||||||
RETURN_TRUE;
|
RETURN_TRUE;
|
||||||
|
|
109
ext/standard/tests/array/array_keys_non_strict.phpt
Normal file
109
ext/standard/tests/array/array_keys_non_strict.phpt
Normal file
|
@ -0,0 +1,109 @@
|
||||||
|
--TEST--
|
||||||
|
array_keys() in non-strict mode
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$arr = array(1, "1", "", NULL, 0, false, true, array());
|
||||||
|
|
||||||
|
$s = 1;
|
||||||
|
var_dump(array_keys($arr, $s));
|
||||||
|
|
||||||
|
$s = "1";
|
||||||
|
var_dump(array_keys($arr, $s));
|
||||||
|
|
||||||
|
$s = "";
|
||||||
|
var_dump(array_keys($arr, $s));
|
||||||
|
|
||||||
|
$s = NULL;
|
||||||
|
var_dump(array_keys($arr, $s));
|
||||||
|
|
||||||
|
$s = 0;
|
||||||
|
var_dump(array_keys($arr, $s));
|
||||||
|
|
||||||
|
$s = false;
|
||||||
|
var_dump(array_keys($arr, $s));
|
||||||
|
|
||||||
|
$s = true;
|
||||||
|
var_dump(array_keys($arr, $s));
|
||||||
|
|
||||||
|
$s = array();
|
||||||
|
var_dump(array_keys($arr, $s));
|
||||||
|
|
||||||
|
?>
|
||||||
|
--EXPECTF--
|
||||||
|
array(3) {
|
||||||
|
[0]=>
|
||||||
|
int(0)
|
||||||
|
[1]=>
|
||||||
|
int(1)
|
||||||
|
[2]=>
|
||||||
|
int(6)
|
||||||
|
}
|
||||||
|
array(3) {
|
||||||
|
[0]=>
|
||||||
|
int(0)
|
||||||
|
[1]=>
|
||||||
|
int(1)
|
||||||
|
[2]=>
|
||||||
|
int(6)
|
||||||
|
}
|
||||||
|
array(4) {
|
||||||
|
[0]=>
|
||||||
|
int(2)
|
||||||
|
[1]=>
|
||||||
|
int(3)
|
||||||
|
[2]=>
|
||||||
|
int(4)
|
||||||
|
[3]=>
|
||||||
|
int(5)
|
||||||
|
}
|
||||||
|
array(5) {
|
||||||
|
[0]=>
|
||||||
|
int(2)
|
||||||
|
[1]=>
|
||||||
|
int(3)
|
||||||
|
[2]=>
|
||||||
|
int(4)
|
||||||
|
[3]=>
|
||||||
|
int(5)
|
||||||
|
[4]=>
|
||||||
|
int(7)
|
||||||
|
}
|
||||||
|
array(4) {
|
||||||
|
[0]=>
|
||||||
|
int(2)
|
||||||
|
[1]=>
|
||||||
|
int(3)
|
||||||
|
[2]=>
|
||||||
|
int(4)
|
||||||
|
[3]=>
|
||||||
|
int(5)
|
||||||
|
}
|
||||||
|
array(5) {
|
||||||
|
[0]=>
|
||||||
|
int(2)
|
||||||
|
[1]=>
|
||||||
|
int(3)
|
||||||
|
[2]=>
|
||||||
|
int(4)
|
||||||
|
[3]=>
|
||||||
|
int(5)
|
||||||
|
[4]=>
|
||||||
|
int(7)
|
||||||
|
}
|
||||||
|
array(3) {
|
||||||
|
[0]=>
|
||||||
|
int(0)
|
||||||
|
[1]=>
|
||||||
|
int(1)
|
||||||
|
[2]=>
|
||||||
|
int(6)
|
||||||
|
}
|
||||||
|
array(3) {
|
||||||
|
[0]=>
|
||||||
|
int(3)
|
||||||
|
[1]=>
|
||||||
|
int(5)
|
||||||
|
[2]=>
|
||||||
|
int(7)
|
||||||
|
}
|
65
ext/standard/tests/array/array_keys_strict.phpt
Normal file
65
ext/standard/tests/array/array_keys_strict.phpt
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
--TEST--
|
||||||
|
array_keys() in strict mode
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$arr = array(1, "1", "", NULL, 0, false, true, array());
|
||||||
|
|
||||||
|
$s = 1;
|
||||||
|
var_dump(array_keys($arr, $s, true));
|
||||||
|
|
||||||
|
$s = "1";
|
||||||
|
var_dump(array_keys($arr, $s, true));
|
||||||
|
|
||||||
|
$s = "";
|
||||||
|
var_dump(array_keys($arr, $s, true));
|
||||||
|
|
||||||
|
$s = NULL;
|
||||||
|
var_dump(array_keys($arr, $s, true));
|
||||||
|
|
||||||
|
$s = 0;
|
||||||
|
var_dump(array_keys($arr, $s, true));
|
||||||
|
|
||||||
|
$s = false;
|
||||||
|
var_dump(array_keys($arr, $s, true));
|
||||||
|
|
||||||
|
$s = true;
|
||||||
|
var_dump(array_keys($arr, $s, true));
|
||||||
|
|
||||||
|
$s = array();
|
||||||
|
var_dump(array_keys($arr, $s, true));
|
||||||
|
|
||||||
|
?>
|
||||||
|
--EXPECTF--
|
||||||
|
array(1) {
|
||||||
|
[0]=>
|
||||||
|
int(0)
|
||||||
|
}
|
||||||
|
array(1) {
|
||||||
|
[0]=>
|
||||||
|
int(1)
|
||||||
|
}
|
||||||
|
array(1) {
|
||||||
|
[0]=>
|
||||||
|
int(2)
|
||||||
|
}
|
||||||
|
array(1) {
|
||||||
|
[0]=>
|
||||||
|
int(3)
|
||||||
|
}
|
||||||
|
array(1) {
|
||||||
|
[0]=>
|
||||||
|
int(4)
|
||||||
|
}
|
||||||
|
array(1) {
|
||||||
|
[0]=>
|
||||||
|
int(5)
|
||||||
|
}
|
||||||
|
array(1) {
|
||||||
|
[0]=>
|
||||||
|
int(6)
|
||||||
|
}
|
||||||
|
array(1) {
|
||||||
|
[0]=>
|
||||||
|
int(7)
|
||||||
|
}
|
65
ext/standard/tests/array/array_keys_strict_ref.phpt
Normal file
65
ext/standard/tests/array/array_keys_strict_ref.phpt
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
--TEST--
|
||||||
|
array_keys() in strict mode with references
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$arr = array(1, "1", "", NULL, 0, false, true, array());
|
||||||
|
|
||||||
|
$s = &$arr[0];
|
||||||
|
var_dump(array_keys($arr, $s, true));
|
||||||
|
|
||||||
|
$s = &$arr[1];
|
||||||
|
var_dump(array_keys($arr, $s, true));
|
||||||
|
|
||||||
|
$s = &$arr[2];
|
||||||
|
var_dump(array_keys($arr, $s, true));
|
||||||
|
|
||||||
|
$s = &$arr[3];
|
||||||
|
var_dump(array_keys($arr, $s, true));
|
||||||
|
|
||||||
|
$s = &$arr[4];
|
||||||
|
var_dump(array_keys($arr, $s, true));
|
||||||
|
|
||||||
|
$s = &$arr[5];
|
||||||
|
var_dump(array_keys($arr, $s, true));
|
||||||
|
|
||||||
|
$s = &$arr[6];
|
||||||
|
var_dump(array_keys($arr, $s, true));
|
||||||
|
|
||||||
|
$s = &$arr[7];
|
||||||
|
var_dump(array_keys($arr, $s, true));
|
||||||
|
|
||||||
|
?>
|
||||||
|
--EXPECTF--
|
||||||
|
array(1) {
|
||||||
|
[0]=>
|
||||||
|
int(0)
|
||||||
|
}
|
||||||
|
array(1) {
|
||||||
|
[0]=>
|
||||||
|
int(1)
|
||||||
|
}
|
||||||
|
array(1) {
|
||||||
|
[0]=>
|
||||||
|
int(2)
|
||||||
|
}
|
||||||
|
array(1) {
|
||||||
|
[0]=>
|
||||||
|
int(3)
|
||||||
|
}
|
||||||
|
array(1) {
|
||||||
|
[0]=>
|
||||||
|
int(4)
|
||||||
|
}
|
||||||
|
array(1) {
|
||||||
|
[0]=>
|
||||||
|
int(5)
|
||||||
|
}
|
||||||
|
array(1) {
|
||||||
|
[0]=>
|
||||||
|
int(6)
|
||||||
|
}
|
||||||
|
array(1) {
|
||||||
|
[0]=>
|
||||||
|
int(7)
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue