From ed197b24eff43b1cc0ec5dc6228ad4c800c5fc57 Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Sun, 19 Oct 2025 23:08:13 +0100 Subject: [PATCH 1/6] Fix GH-20194 without opcache --- Zend/tests/offsets/gh20194.phpt | 15 +++ Zend/zend_compile.c | 9 +- Zend/zend_vm_def.h | 6 +- Zend/zend_vm_execute.h | 192 ++++++++++++++++++++++++++------ 4 files changed, 184 insertions(+), 38 deletions(-) create mode 100644 Zend/tests/offsets/gh20194.phpt diff --git a/Zend/tests/offsets/gh20194.phpt b/Zend/tests/offsets/gh20194.phpt new file mode 100644 index 0000000000000..15965727a82b0 --- /dev/null +++ b/Zend/tests/offsets/gh20194.phpt @@ -0,0 +1,15 @@ +--TEST-- +GH-20194: Using null as an array offset does not emit deprecation when resolved at compile time +--FILE-- + 1]; + +echo $a[null]; + +?> +--EXPECTF-- +Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d + +Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d +1 diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 35228722aa986..0180e6e8e1c0a 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -10175,9 +10175,7 @@ static bool zend_try_ct_eval_array(zval *result, zend_ast *ast) /* {{{ */ zend_long lval = zend_dval_to_lval_silent(Z_DVAL_P(key)); /* Incompatible float will generate an error, leave this to run-time */ if (!zend_is_long_compatible(Z_DVAL_P(key), lval)) { - zval_ptr_dtor_nogc(value); - zval_ptr_dtor(result); - return 0; + goto fail; } zend_hash_index_update(Z_ARRVAL_P(result), lval, value); break; @@ -10189,13 +10187,14 @@ static bool zend_try_ct_eval_array(zval *result, zend_ast *ast) /* {{{ */ zend_hash_index_update(Z_ARRVAL_P(result), 1, value); break; case IS_NULL: - zend_hash_update(Z_ARRVAL_P(result), ZSTR_EMPTY_ALLOC(), value); - break; + /* Null key will generate a warning at run-time. */ + goto fail; default: zend_error_noreturn(E_COMPILE_ERROR, "Illegal offset type"); break; } } else if (!zend_hash_next_index_insert(Z_ARRVAL_P(result), value)) { +fail: zval_ptr_dtor_nogc(value); zval_ptr_dtor(result); return 0; diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index b670846ed52d3..e5694d6364aef 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -6278,7 +6278,11 @@ ZEND_VM_C_LABEL(num_index): } else if ((OP2_TYPE & (IS_VAR|IS_CV)) && EXPECTED(Z_TYPE_P(offset) == IS_REFERENCE)) { offset = Z_REFVAL_P(offset); ZEND_VM_C_GOTO(add_again); - } else if (Z_TYPE_P(offset) == IS_NULL) { + } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { + zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); + if (UNEXPECTED(EG(exception))) { + HANDLE_EXCEPTION(); + } str = ZSTR_EMPTY_ALLOC(); ZEND_VM_C_GOTO(str_index); } else if (Z_TYPE_P(offset) == IS_DOUBLE) { diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index da8e40ec24017..94064b55faa45 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -7944,7 +7944,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_ADD_ARRAY_ELE } else if ((IS_CONST & (IS_VAR|IS_CV)) && EXPECTED(Z_TYPE_P(offset) == IS_REFERENCE)) { offset = Z_REFVAL_P(offset); goto add_again; - } else if (Z_TYPE_P(offset) == IS_NULL) { + } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { + zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); + if (UNEXPECTED(EG(exception))) { + HANDLE_EXCEPTION(); + } str = ZSTR_EMPTY_ALLOC(); goto str_index; } else if (Z_TYPE_P(offset) == IS_DOUBLE) { @@ -10423,7 +10427,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_ADD_ARRAY_ELE } else if (((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_CV)) && EXPECTED(Z_TYPE_P(offset) == IS_REFERENCE)) { offset = Z_REFVAL_P(offset); goto add_again; - } else if (Z_TYPE_P(offset) == IS_NULL) { + } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { + zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); + if (UNEXPECTED(EG(exception))) { + HANDLE_EXCEPTION(); + } str = ZSTR_EMPTY_ALLOC(); goto str_index; } else if (Z_TYPE_P(offset) == IS_DOUBLE) { @@ -11364,7 +11372,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_ADD_ARRAY_ELE } else if ((IS_UNUSED & (IS_VAR|IS_CV)) && EXPECTED(Z_TYPE_P(offset) == IS_REFERENCE)) { offset = Z_REFVAL_P(offset); goto add_again; - } else if (Z_TYPE_P(offset) == IS_NULL) { + } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { + zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); + if (UNEXPECTED(EG(exception))) { + HANDLE_EXCEPTION(); + } str = ZSTR_EMPTY_ALLOC(); goto str_index; } else if (Z_TYPE_P(offset) == IS_DOUBLE) { @@ -12979,7 +12991,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_ADD_ARRAY_ELE } else if ((IS_CV & (IS_VAR|IS_CV)) && EXPECTED(Z_TYPE_P(offset) == IS_REFERENCE)) { offset = Z_REFVAL_P(offset); goto add_again; - } else if (Z_TYPE_P(offset) == IS_NULL) { + } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { + zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); + if (UNEXPECTED(EG(exception))) { + HANDLE_EXCEPTION(); + } str = ZSTR_EMPTY_ALLOC(); goto str_index; } else if (Z_TYPE_P(offset) == IS_DOUBLE) { @@ -21281,7 +21297,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_ADD_ARRAY_ELE } else if ((IS_CONST & (IS_VAR|IS_CV)) && EXPECTED(Z_TYPE_P(offset) == IS_REFERENCE)) { offset = Z_REFVAL_P(offset); goto add_again; - } else if (Z_TYPE_P(offset) == IS_NULL) { + } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { + zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); + if (UNEXPECTED(EG(exception))) { + HANDLE_EXCEPTION(); + } str = ZSTR_EMPTY_ALLOC(); goto str_index; } else if (Z_TYPE_P(offset) == IS_DOUBLE) { @@ -21725,7 +21745,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_ADD_ARRAY_ELE } else if (((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_CV)) && EXPECTED(Z_TYPE_P(offset) == IS_REFERENCE)) { offset = Z_REFVAL_P(offset); goto add_again; - } else if (Z_TYPE_P(offset) == IS_NULL) { + } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { + zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); + if (UNEXPECTED(EG(exception))) { + HANDLE_EXCEPTION(); + } str = ZSTR_EMPTY_ALLOC(); goto str_index; } else if (Z_TYPE_P(offset) == IS_DOUBLE) { @@ -22183,7 +22207,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_ADD_ARRAY_ELE } else if ((IS_UNUSED & (IS_VAR|IS_CV)) && EXPECTED(Z_TYPE_P(offset) == IS_REFERENCE)) { offset = Z_REFVAL_P(offset); goto add_again; - } else if (Z_TYPE_P(offset) == IS_NULL) { + } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { + zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); + if (UNEXPECTED(EG(exception))) { + HANDLE_EXCEPTION(); + } str = ZSTR_EMPTY_ALLOC(); goto str_index; } else if (Z_TYPE_P(offset) == IS_DOUBLE) { @@ -22590,7 +22618,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_ADD_ARRAY_ELE } else if ((IS_CV & (IS_VAR|IS_CV)) && EXPECTED(Z_TYPE_P(offset) == IS_REFERENCE)) { offset = Z_REFVAL_P(offset); goto add_again; - } else if (Z_TYPE_P(offset) == IS_NULL) { + } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { + zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); + if (UNEXPECTED(EG(exception))) { + HANDLE_EXCEPTION(); + } str = ZSTR_EMPTY_ALLOC(); goto str_index; } else if (Z_TYPE_P(offset) == IS_DOUBLE) { @@ -26533,7 +26565,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_ADD_ARRAY_ELE } else if ((IS_CONST & (IS_VAR|IS_CV)) && EXPECTED(Z_TYPE_P(offset) == IS_REFERENCE)) { offset = Z_REFVAL_P(offset); goto add_again; - } else if (Z_TYPE_P(offset) == IS_NULL) { + } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { + zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); + if (UNEXPECTED(EG(exception))) { + HANDLE_EXCEPTION(); + } str = ZSTR_EMPTY_ALLOC(); goto str_index; } else if (Z_TYPE_P(offset) == IS_DOUBLE) { @@ -29085,7 +29121,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_ADD_ARRAY_ELE } else if (((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_CV)) && EXPECTED(Z_TYPE_P(offset) == IS_REFERENCE)) { offset = Z_REFVAL_P(offset); goto add_again; - } else if (Z_TYPE_P(offset) == IS_NULL) { + } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { + zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); + if (UNEXPECTED(EG(exception))) { + HANDLE_EXCEPTION(); + } str = ZSTR_EMPTY_ALLOC(); goto str_index; } else if (Z_TYPE_P(offset) == IS_DOUBLE) { @@ -31191,7 +31231,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_ADD_ARRAY_ELE } else if ((IS_UNUSED & (IS_VAR|IS_CV)) && EXPECTED(Z_TYPE_P(offset) == IS_REFERENCE)) { offset = Z_REFVAL_P(offset); goto add_again; - } else if (Z_TYPE_P(offset) == IS_NULL) { + } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { + zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); + if (UNEXPECTED(EG(exception))) { + HANDLE_EXCEPTION(); + } str = ZSTR_EMPTY_ALLOC(); goto str_index; } else if (Z_TYPE_P(offset) == IS_DOUBLE) { @@ -33613,7 +33657,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_ADD_ARRAY_ELE } else if ((IS_CV & (IS_VAR|IS_CV)) && EXPECTED(Z_TYPE_P(offset) == IS_REFERENCE)) { offset = Z_REFVAL_P(offset); goto add_again; - } else if (Z_TYPE_P(offset) == IS_NULL) { + } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { + zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); + if (UNEXPECTED(EG(exception))) { + HANDLE_EXCEPTION(); + } str = ZSTR_EMPTY_ALLOC(); goto str_index; } else if (Z_TYPE_P(offset) == IS_DOUBLE) { @@ -46127,7 +46175,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_ADD_ARRAY_ELE } else if ((IS_CONST & (IS_VAR|IS_CV)) && EXPECTED(Z_TYPE_P(offset) == IS_REFERENCE)) { offset = Z_REFVAL_P(offset); goto add_again; - } else if (Z_TYPE_P(offset) == IS_NULL) { + } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { + zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); + if (UNEXPECTED(EG(exception))) { + HANDLE_EXCEPTION(); + } str = ZSTR_EMPTY_ALLOC(); goto str_index; } else if (Z_TYPE_P(offset) == IS_DOUBLE) { @@ -49967,7 +50019,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_ADD_ARRAY_ELE } else if (((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_CV)) && EXPECTED(Z_TYPE_P(offset) == IS_REFERENCE)) { offset = Z_REFVAL_P(offset); goto add_again; - } else if (Z_TYPE_P(offset) == IS_NULL) { + } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { + zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); + if (UNEXPECTED(EG(exception))) { + HANDLE_EXCEPTION(); + } str = ZSTR_EMPTY_ALLOC(); goto str_index; } else if (Z_TYPE_P(offset) == IS_DOUBLE) { @@ -51991,7 +52047,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_ADD_ARRAY_ELE } else if ((IS_UNUSED & (IS_VAR|IS_CV)) && EXPECTED(Z_TYPE_P(offset) == IS_REFERENCE)) { offset = Z_REFVAL_P(offset); goto add_again; - } else if (Z_TYPE_P(offset) == IS_NULL) { + } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { + zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); + if (UNEXPECTED(EG(exception))) { + HANDLE_EXCEPTION(); + } str = ZSTR_EMPTY_ALLOC(); goto str_index; } else if (Z_TYPE_P(offset) == IS_DOUBLE) { @@ -55725,7 +55785,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_ADD_ARRAY_ELE } else if ((IS_CV & (IS_VAR|IS_CV)) && EXPECTED(Z_TYPE_P(offset) == IS_REFERENCE)) { offset = Z_REFVAL_P(offset); goto add_again; - } else if (Z_TYPE_P(offset) == IS_NULL) { + } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { + zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); + if (UNEXPECTED(EG(exception))) { + HANDLE_EXCEPTION(); + } str = ZSTR_EMPTY_ALLOC(); goto str_index; } else if (Z_TYPE_P(offset) == IS_DOUBLE) { @@ -63368,7 +63432,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_ADD_ARRAY_ELEMENT_ } else if ((IS_CONST & (IS_VAR|IS_CV)) && EXPECTED(Z_TYPE_P(offset) == IS_REFERENCE)) { offset = Z_REFVAL_P(offset); goto add_again; - } else if (Z_TYPE_P(offset) == IS_NULL) { + } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { + zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); + if (UNEXPECTED(EG(exception))) { + HANDLE_EXCEPTION(); + } str = ZSTR_EMPTY_ALLOC(); goto str_index; } else if (Z_TYPE_P(offset) == IS_DOUBLE) { @@ -65847,7 +65915,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_ADD_ARRAY_ELEMENT_ } else if (((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_CV)) && EXPECTED(Z_TYPE_P(offset) == IS_REFERENCE)) { offset = Z_REFVAL_P(offset); goto add_again; - } else if (Z_TYPE_P(offset) == IS_NULL) { + } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { + zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); + if (UNEXPECTED(EG(exception))) { + HANDLE_EXCEPTION(); + } str = ZSTR_EMPTY_ALLOC(); goto str_index; } else if (Z_TYPE_P(offset) == IS_DOUBLE) { @@ -66686,7 +66758,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_ADD_ARRAY_ELEMENT_ } else if ((IS_UNUSED & (IS_VAR|IS_CV)) && EXPECTED(Z_TYPE_P(offset) == IS_REFERENCE)) { offset = Z_REFVAL_P(offset); goto add_again; - } else if (Z_TYPE_P(offset) == IS_NULL) { + } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { + zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); + if (UNEXPECTED(EG(exception))) { + HANDLE_EXCEPTION(); + } str = ZSTR_EMPTY_ALLOC(); goto str_index; } else if (Z_TYPE_P(offset) == IS_DOUBLE) { @@ -68301,7 +68377,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_ADD_ARRAY_ELEMENT_ } else if ((IS_CV & (IS_VAR|IS_CV)) && EXPECTED(Z_TYPE_P(offset) == IS_REFERENCE)) { offset = Z_REFVAL_P(offset); goto add_again; - } else if (Z_TYPE_P(offset) == IS_NULL) { + } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { + zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); + if (UNEXPECTED(EG(exception))) { + HANDLE_EXCEPTION(); + } str = ZSTR_EMPTY_ALLOC(); goto str_index; } else if (Z_TYPE_P(offset) == IS_DOUBLE) { @@ -76503,7 +76583,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_ADD_ARRAY_ELEMENT_ } else if ((IS_CONST & (IS_VAR|IS_CV)) && EXPECTED(Z_TYPE_P(offset) == IS_REFERENCE)) { offset = Z_REFVAL_P(offset); goto add_again; - } else if (Z_TYPE_P(offset) == IS_NULL) { + } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { + zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); + if (UNEXPECTED(EG(exception))) { + HANDLE_EXCEPTION(); + } str = ZSTR_EMPTY_ALLOC(); goto str_index; } else if (Z_TYPE_P(offset) == IS_DOUBLE) { @@ -76947,7 +77031,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_ADD_ARRAY_ELEMENT_ } else if (((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_CV)) && EXPECTED(Z_TYPE_P(offset) == IS_REFERENCE)) { offset = Z_REFVAL_P(offset); goto add_again; - } else if (Z_TYPE_P(offset) == IS_NULL) { + } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { + zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); + if (UNEXPECTED(EG(exception))) { + HANDLE_EXCEPTION(); + } str = ZSTR_EMPTY_ALLOC(); goto str_index; } else if (Z_TYPE_P(offset) == IS_DOUBLE) { @@ -77405,7 +77493,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_ADD_ARRAY_ELEMENT_ } else if ((IS_UNUSED & (IS_VAR|IS_CV)) && EXPECTED(Z_TYPE_P(offset) == IS_REFERENCE)) { offset = Z_REFVAL_P(offset); goto add_again; - } else if (Z_TYPE_P(offset) == IS_NULL) { + } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { + zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); + if (UNEXPECTED(EG(exception))) { + HANDLE_EXCEPTION(); + } str = ZSTR_EMPTY_ALLOC(); goto str_index; } else if (Z_TYPE_P(offset) == IS_DOUBLE) { @@ -77812,7 +77904,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_ADD_ARRAY_ELEMENT_ } else if ((IS_CV & (IS_VAR|IS_CV)) && EXPECTED(Z_TYPE_P(offset) == IS_REFERENCE)) { offset = Z_REFVAL_P(offset); goto add_again; - } else if (Z_TYPE_P(offset) == IS_NULL) { + } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { + zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); + if (UNEXPECTED(EG(exception))) { + HANDLE_EXCEPTION(); + } str = ZSTR_EMPTY_ALLOC(); goto str_index; } else if (Z_TYPE_P(offset) == IS_DOUBLE) { @@ -81755,7 +81851,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_ADD_ARRAY_ELEMENT_ } else if ((IS_CONST & (IS_VAR|IS_CV)) && EXPECTED(Z_TYPE_P(offset) == IS_REFERENCE)) { offset = Z_REFVAL_P(offset); goto add_again; - } else if (Z_TYPE_P(offset) == IS_NULL) { + } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { + zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); + if (UNEXPECTED(EG(exception))) { + HANDLE_EXCEPTION(); + } str = ZSTR_EMPTY_ALLOC(); goto str_index; } else if (Z_TYPE_P(offset) == IS_DOUBLE) { @@ -84307,7 +84407,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_ADD_ARRAY_ELEMENT_ } else if (((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_CV)) && EXPECTED(Z_TYPE_P(offset) == IS_REFERENCE)) { offset = Z_REFVAL_P(offset); goto add_again; - } else if (Z_TYPE_P(offset) == IS_NULL) { + } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { + zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); + if (UNEXPECTED(EG(exception))) { + HANDLE_EXCEPTION(); + } str = ZSTR_EMPTY_ALLOC(); goto str_index; } else if (Z_TYPE_P(offset) == IS_DOUBLE) { @@ -86413,7 +86517,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_ADD_ARRAY_ELEMENT_ } else if ((IS_UNUSED & (IS_VAR|IS_CV)) && EXPECTED(Z_TYPE_P(offset) == IS_REFERENCE)) { offset = Z_REFVAL_P(offset); goto add_again; - } else if (Z_TYPE_P(offset) == IS_NULL) { + } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { + zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); + if (UNEXPECTED(EG(exception))) { + HANDLE_EXCEPTION(); + } str = ZSTR_EMPTY_ALLOC(); goto str_index; } else if (Z_TYPE_P(offset) == IS_DOUBLE) { @@ -88835,7 +88943,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_ADD_ARRAY_ELEMENT_ } else if ((IS_CV & (IS_VAR|IS_CV)) && EXPECTED(Z_TYPE_P(offset) == IS_REFERENCE)) { offset = Z_REFVAL_P(offset); goto add_again; - } else if (Z_TYPE_P(offset) == IS_NULL) { + } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { + zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); + if (UNEXPECTED(EG(exception))) { + HANDLE_EXCEPTION(); + } str = ZSTR_EMPTY_ALLOC(); goto str_index; } else if (Z_TYPE_P(offset) == IS_DOUBLE) { @@ -101349,7 +101461,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_ADD_ARRAY_ELEMENT_ } else if ((IS_CONST & (IS_VAR|IS_CV)) && EXPECTED(Z_TYPE_P(offset) == IS_REFERENCE)) { offset = Z_REFVAL_P(offset); goto add_again; - } else if (Z_TYPE_P(offset) == IS_NULL) { + } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { + zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); + if (UNEXPECTED(EG(exception))) { + HANDLE_EXCEPTION(); + } str = ZSTR_EMPTY_ALLOC(); goto str_index; } else if (Z_TYPE_P(offset) == IS_DOUBLE) { @@ -105189,7 +105305,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_ADD_ARRAY_ELEMENT_ } else if (((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_CV)) && EXPECTED(Z_TYPE_P(offset) == IS_REFERENCE)) { offset = Z_REFVAL_P(offset); goto add_again; - } else if (Z_TYPE_P(offset) == IS_NULL) { + } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { + zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); + if (UNEXPECTED(EG(exception))) { + HANDLE_EXCEPTION(); + } str = ZSTR_EMPTY_ALLOC(); goto str_index; } else if (Z_TYPE_P(offset) == IS_DOUBLE) { @@ -107111,7 +107231,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_ADD_ARRAY_ELEMENT_ } else if ((IS_UNUSED & (IS_VAR|IS_CV)) && EXPECTED(Z_TYPE_P(offset) == IS_REFERENCE)) { offset = Z_REFVAL_P(offset); goto add_again; - } else if (Z_TYPE_P(offset) == IS_NULL) { + } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { + zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); + if (UNEXPECTED(EG(exception))) { + HANDLE_EXCEPTION(); + } str = ZSTR_EMPTY_ALLOC(); goto str_index; } else if (Z_TYPE_P(offset) == IS_DOUBLE) { @@ -110845,7 +110969,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_ADD_ARRAY_ELEMENT_ } else if ((IS_CV & (IS_VAR|IS_CV)) && EXPECTED(Z_TYPE_P(offset) == IS_REFERENCE)) { offset = Z_REFVAL_P(offset); goto add_again; - } else if (Z_TYPE_P(offset) == IS_NULL) { + } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { + zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); + if (UNEXPECTED(EG(exception))) { + HANDLE_EXCEPTION(); + } str = ZSTR_EMPTY_ALLOC(); goto str_index; } else if (Z_TYPE_P(offset) == IS_DOUBLE) { From f6957df618b320262628335062de2b3d162f364a Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Mon, 20 Oct 2025 15:56:47 +0100 Subject: [PATCH 2/6] Fix tests --- .../tests/mysqli_stmt_execute_bind.phpt | 2 +- .../preg_replace_callback_array_error.phpt | 15 - ext/spl/tests/iterator_049.phpt | 6 +- ext/spl/tests/iterator_049b.phpt | 6 +- ..._recursive_iterator_iterator_key_case.phpt | 2 +- ext/standard/tests/array/005.phpt | 4 +- .../array_change_key_case_variation3.phpt | 130 ++------- .../array_change_key_case_variation8.phpt | 10 +- .../tests/array/array_combine_variation3.phpt | 58 ++-- .../tests/array/array_combine_variation4.phpt | 32 +-- .../array/array_diff_key_variation7.phpt | 52 ---- .../array/array_diff_uassoc_variation12.phpt | 52 ---- .../array/array_diff_ukey_variation9.phpt | 52 ---- .../tests/array/array_fill_variation5.phpt | 28 +- .../tests/array/array_filter_variation3.phpt | 40 +-- .../tests/array/array_flip_variation2.phpt | 42 +-- .../tests/array/array_flip_variation5.phpt | 24 +- .../array_intersect_assoc_variation3.phpt | 43 +-- .../array_intersect_assoc_variation4.phpt | 49 +--- .../array_intersect_assoc_variation5.phpt | 14 +- .../array_intersect_assoc_variation6.phpt | 12 +- .../array/array_intersect_key_variation7.phpt | 56 ---- .../array/array_intersect_variation3.phpt | 95 ++----- .../array/array_intersect_variation4.phpt | 102 +++---- .../array/array_intersect_variation5.phpt | 18 +- .../array/array_intersect_variation6.phpt | 18 +- .../tests/array/array_key_exists.phpt | 2 +- .../array/array_key_exists_variation8.phpt | 267 +----------------- ext/standard/tests/array/array_key_first.phpt | 4 +- ext/standard/tests/array/array_key_last.phpt | 4 +- .../tests/array/array_keys_variation_001.phpt | 8 +- .../tests/array/array_map_variation3.phpt | 31 +- .../tests/array/array_map_variation4.phpt | 12 +- .../tests/array/array_map_variation7.phpt | 14 +- .../array_merge_recursive_variation3.phpt | 94 ++---- .../array_merge_recursive_variation4.phpt | 20 +- .../tests/array/array_merge_variation4.phpt | 150 +--------- .../tests/array/array_merge_variation7.phpt | 10 +- .../tests/array/array_pad_variation6.phpt | 91 +++--- ext/standard/tests/array/array_pop.phpt | 4 +- .../tests/array/array_pop_variation.phpt | 2 +- ext/standard/tests/array/array_push.phpt | 4 +- .../tests/array/array_push_variation6.phpt | 65 +---- .../tests/array/array_reverse_variation3.phpt | 74 +---- .../tests/array/array_reverse_variation4.phpt | 32 +-- .../tests/array/array_search_variation2.phpt | 2 +- .../tests/array/array_shift_variation3.phpt | 69 +---- .../tests/array/array_slice_variation7.phpt | 113 +------- .../tests/array/array_unique_variation2.phpt | 35 +-- .../tests/array/array_unique_variation3.phpt | 10 +- .../tests/array/array_unshift_variation3.phpt | 68 ++--- .../tests/array/array_unshift_variation4.phpt | 32 +-- .../tests/array/array_values_variation3.phpt | 83 +----- ext/standard/tests/array/count_recursive.phpt | 6 +- .../tests/array/extract_variation4.phpt | 2 +- .../tests/array/extract_variation7.phpt | 2 +- .../tests/array/in_array_variation2.phpt | 2 +- ext/standard/tests/array/key_variation2.phpt | 54 +--- .../tests/array/sort/arsort_variation11.phpt | 2 +- .../arsort_variation_escape_sequences.phpt | 2 - .../tests/array/sort/asort_variation11.phpt | 2 +- .../asort_variation_escape_sequences.phpt | 2 - .../tests/array/sort/krsort_variation8.phpt | 2 +- .../krsort_variation_escape_sequences.phpt | 2 - .../tests/array/sort/ksort_variation8.phpt | 2 +- .../ksort_variation_escape_sequences.phpt | 2 - .../array/sort/natcasesort_variation11.phpt | 83 +----- .../tests/array/sort/shuffle_variation4.phpt | 18 +- .../tests/array/sort/uasort_variation3.phpt | 13 +- .../tests/array/sort/usort_variation3.phpt | 4 +- .../tests/strings/join_variation3.phpt | 17 +- 71 files changed, 411 insertions(+), 2068 deletions(-) delete mode 100644 ext/standard/tests/array/array_diff_key_variation7.phpt delete mode 100644 ext/standard/tests/array/array_diff_uassoc_variation12.phpt delete mode 100644 ext/standard/tests/array/array_diff_ukey_variation9.phpt delete mode 100644 ext/standard/tests/array/array_intersect_key_variation7.phpt diff --git a/ext/mysqli/tests/mysqli_stmt_execute_bind.phpt b/ext/mysqli/tests/mysqli_stmt_execute_bind.phpt index 5005cbf5fb5d9..82d4be4ea18d3 100644 --- a/ext/mysqli/tests/mysqli_stmt_execute_bind.phpt +++ b/ext/mysqli/tests/mysqli_stmt_execute_bind.phpt @@ -118,7 +118,7 @@ $stmt = null; // 12. Only list arrays are allowed $stmt = $link->prepare('SELECT label, ? AS anon, ? AS num FROM test WHERE id=?'); try { - $stmt->execute(['A'=>'abc', 2=>42, null=>$id]); + $stmt->execute(['A'=>'abc', 2=>42, ''=>$id]); } catch (ValueError $e) { echo '[008] '.$e->getMessage()."\n"; } diff --git a/ext/pcre/tests/preg_replace_callback_array_error.phpt b/ext/pcre/tests/preg_replace_callback_array_error.phpt index fc531b3b02a10..02f50d048cd0e 100644 --- a/ext/pcre/tests/preg_replace_callback_array_error.phpt +++ b/ext/pcre/tests/preg_replace_callback_array_error.phpt @@ -21,18 +21,6 @@ var_dump( ) ); -var_dump( - preg_replace_callback_array( - [ - '/a/' => 'b', - null => function () { - return 'ok'; - }, - ], - 'a' - ) -); - // backslashes var_dump( @@ -92,9 +80,6 @@ var_dump( Warning: preg_replace_callback_array(): Empty regular expression in %spreg_replace_callback_array_error.php on line %d NULL -Warning: preg_replace_callback_array(): Empty regular expression in %spreg_replace_callback_array_error.php on line %d -NULL - Warning: preg_replace_callback_array(): Delimiter must not be alphanumeric, backslash, or NUL byte in %spreg_replace_callback_array_error.php on line %d NULL diff --git a/ext/spl/tests/iterator_049.phpt b/ext/spl/tests/iterator_049.phpt index e9b81fbff39be..6fccbd5911623 100644 --- a/ext/spl/tests/iterator_049.phpt +++ b/ext/spl/tests/iterator_049.phpt @@ -1,10 +1,10 @@ --TEST-- -SPL: ArrayIterator with NULL key +SPL: ArrayIterator with empty string key --FILE-- NULL)); -@var_dump($ar); +$ar = new ArrayIterator(array(''=>NULL)); +var_dump($ar); var_dump($ar->getArrayCopy()); ?> diff --git a/ext/spl/tests/iterator_049b.phpt b/ext/spl/tests/iterator_049b.phpt index 1e1176c7169fc..7a957aa70c5cf 100644 --- a/ext/spl/tests/iterator_049b.phpt +++ b/ext/spl/tests/iterator_049b.phpt @@ -1,17 +1,17 @@ --TEST-- -SPL: ArrayIterator with NULL key +SPL: ArrayIterator with empty string key --FILE-- 1, + ''=>1, "\0"=>2, "\0\0"=>3, "\0\0\0"=>4, "\0*"=>5, "\0*\0"=>6, )); -@var_dump($ar); +var_dump($ar); var_dump($ar->getArrayCopy()); ?> diff --git a/ext/spl/tests/spl_recursive_iterator_iterator_key_case.phpt b/ext/spl/tests/spl_recursive_iterator_iterator_key_case.phpt index 4b8cfaa53d819..257a961cee80f 100644 --- a/ext/spl/tests/spl_recursive_iterator_iterator_key_case.phpt +++ b/ext/spl/tests/spl_recursive_iterator_iterator_key_case.phpt @@ -5,7 +5,7 @@ Rohan Abraham (rohanabrahams@gmail.com) TestFest London May 2009 --FILE-- 1, "two"=>2, "three"=>array("four"=>4, "five"=>5, "six"=>array("seven"=>7)), "eight"=>8, -100 => 10, NULL => "null"); + $ar = array("one"=>1, "two"=>2, "three"=>array("four"=>4, "five"=>5, "six"=>array("seven"=>7)), "eight"=>8, -100 => 10, '' => "null"); $it = new RecursiveArrayIterator($ar); $it = new RecursiveIteratorIterator($it); foreach($it as $k=>$v) diff --git a/ext/standard/tests/array/005.phpt b/ext/standard/tests/array/005.phpt index 40e9eac265fec..1980d4ba14bf4 100644 --- a/ext/standard/tests/array/005.phpt +++ b/ext/standard/tests/array/005.phpt @@ -18,7 +18,7 @@ $mixed_array = array( array( "1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five" ), array( 1 => "one", 2 => "two", 3 => 7, 4 => "four", 5 => "five" ), array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2 => "float", "F" => "FFF", - "blank" => "", 3 => 3.7, 5 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ), + "blank" => "", 3 => 3.7, 5 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL), array( 12, "name", 'age', '45' ), array( array("oNe", "tWo", 4), array(10, 20, 30, 40, 50), array() ), array( "one" => 1, "one" => 2, "three" => 3, 3, 4, 3 => 33, 4 => 44, 5, 6, @@ -202,7 +202,7 @@ array(12) { [4]=> int(6) [""]=> - int(3) + string(5) "blank" [2]=> string(5) "float" ["F"]=> diff --git a/ext/standard/tests/array/array_change_key_case_variation3.phpt b/ext/standard/tests/array/array_change_key_case_variation3.phpt index 0c3ed4eb0deac..886eed3862c7f 100644 --- a/ext/standard/tests/array/array_change_key_case_variation3.phpt +++ b/ext/standard/tests/array/array_change_key_case_variation3.phpt @@ -9,76 +9,28 @@ Test array_change_key_case() function : usage variations - different data types echo "*** Testing array_change_key_case() : usage variations ***\n"; -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// heredoc string -$heredoc = << array( +$inputs = [ + 'int' => [ 0 => 'zero', 1 => 'one', 12345 => 'positive', -2345 => 'negative', - ), - - // null data -/*3*/ 'null uppercase' => array( - NULL => 'null 1', - ), - 'null lowercase' => array( - null => 'null 2', - ), - - // boolean data -/*4*/ 'bool lowercase' => array( - true => 'lowert', - false => 'lowerf', - ), - 'bool uppercase' => array( - TRUE => 'uppert', - FALSE => 'upperf', - ), - - // empty data -/*5*/ 'empty double quotes' => array( - "" => 'emptyd', - ), - 'empty single quotes' => array( - '' => 'emptys', - ), - - // string data -/*6*/ 'string' => array( - "stringd" => 'stringd', + ], + 'bool' => [ + true => 'true', + false => 'false', + ], + 'string' => [ 'strings' => 'strings', - $heredoc => 'stringh', - ), - - // undefined data -/*8*/ 'undefined' => array( - @$undefined_var => 'undefined', - ), - - // unset data -/*9*/ 'unset' => array( - @$unset_var => 'unset', - ), -); + '' => 'emptys', + ], +]; // loop through each sub-array of $inputs to check the behavior of array_change_key_case() -$iterator = 1; foreach($inputs as $key => $input) { - echo "\n-- Iteration $iterator : $key data --\n"; + echo "\n-- $key data --\n"; var_dump( array_change_key_case($input, CASE_UPPER) ); - $iterator++; }; echo "Done"; @@ -86,7 +38,7 @@ echo "Done"; --EXPECT-- *** Testing array_change_key_case() : usage variations *** --- Iteration 1 : int data -- +-- int data -- array(4) { [0]=> string(4) "zero" @@ -98,65 +50,19 @@ array(4) { string(8) "negative" } --- Iteration 2 : null uppercase data -- -array(1) { - [""]=> - string(6) "null 1" -} - --- Iteration 3 : null lowercase data -- -array(1) { - [""]=> - string(6) "null 2" -} - --- Iteration 4 : bool lowercase data -- +-- bool data -- array(2) { [1]=> - string(6) "lowert" + string(4) "true" [0]=> - string(6) "lowerf" + string(5) "false" } --- Iteration 5 : bool uppercase data -- +-- string data -- array(2) { - [1]=> - string(6) "uppert" - [0]=> - string(6) "upperf" -} - --- Iteration 6 : empty double quotes data -- -array(1) { - [""]=> - string(6) "emptyd" -} - --- Iteration 7 : empty single quotes data -- -array(1) { - [""]=> - string(6) "emptys" -} - --- Iteration 8 : string data -- -array(3) { - ["STRINGD"]=> - string(7) "stringd" ["STRINGS"]=> string(7) "strings" - ["HELLO WORLD"]=> - string(7) "stringh" -} - --- Iteration 9 : undefined data -- -array(1) { [""]=> - string(9) "undefined" -} - --- Iteration 10 : unset data -- -array(1) { - [""]=> - string(5) "unset" + string(6) "emptys" } Done diff --git a/ext/standard/tests/array/array_change_key_case_variation8.phpt b/ext/standard/tests/array/array_change_key_case_variation8.phpt index bb4dbc4af60f0..892cda2818ffe 100644 --- a/ext/standard/tests/array/array_change_key_case_variation8.phpt +++ b/ext/standard/tests/array/array_change_key_case_variation8.phpt @@ -10,7 +10,7 @@ echo "*** Testing array_change_key_case() : usage variations ***\n"; $inputs = array ( // group of escape sequences - array(null => 1, NULL => 2, "\a" => 3, "\cx" => 4, "\e" => 5, "\f" => 6, "\n" => 7, "\t" => 8, "\xhh" => 9, "\ddd" => 10, "\v" => 11), + array("\a" => 3, "\cx" => 4, "\e" => 5, "\f" => 6, "\n" => 7, "\t" => 8, "\xhh" => 9, "\ddd" => 10, "\v" => 11), // array contains combination of capital/small letters array("lemoN" => 1, "Orange" => 2, "banana" => 3, "apple" => 4, "Test" => 5, "TTTT" => 6, "ttt" => 7, "ww" => 8, "x" => 9, "X" => 10, "oraNGe" => 11, "BANANA" => 12) @@ -29,9 +29,7 @@ echo "Done"; *** Testing array_change_key_case() : usage variations *** -- $case = default -- -array(10) { - [""]=> - int(2) +array(9) { ["\a"]=> int(3) ["\cx"]=> @@ -53,9 +51,7 @@ array(10) { int(11) } -- $case = upper -- -array(10) { - [""]=> - int(2) +array(9) { ["\A"]=> int(3) ["\CX"]=> diff --git a/ext/standard/tests/array/array_combine_variation3.phpt b/ext/standard/tests/array/array_combine_variation3.phpt index 94901eedf6495..241ead058c809 100644 --- a/ext/standard/tests/array/array_combine_variation3.phpt +++ b/ext/standard/tests/array/array_combine_variation3.phpt @@ -23,13 +23,6 @@ the lazy dog This is a double quoted string EOT; -// heredoc with different whitespaces -$diff_whitespaces = <<22 @@ -45,9 +38,9 @@ $arrays = array ( array(false,true), // with default keys and boolean values array(), // empty array /*5*/ array(NULL), // with NULL - array("a\v\f","aaaa\r","b","b\tbbb","c","\[\]\!\@\#\$\%\^\&\*\(\)\{\}"), // with double quoted strings - array('a\v\f','aaaa\r','b','b\tbbb','c','\[\]\!\@\#\$\%\^\&\*\(\)\{\}'), // with single quoted strings - array("h1" => $blank_line, "h2" => $multiline_string, "h3" => $diff_whitespaces, $numeric_string), // with heredocs + array("a\v\f","aaaa\n","b","b\tbbb","c","\[\]\!\@\#\$\%\^\&\*\(\)\{\}"), // with double quoted strings + array('a\v\f','aaaa\n','b','b\tbbb','c','\[\]\!\@\#\$\%\^\&\*\(\)\{\}'), // with single quoted strings + array("h1" => $blank_line, "h2" => $multiline_string, $numeric_string), // with heredocs // associative arrays /*9*/ array(1 => "one", 2 => "two", 3 => "three"), // explicit numeric keys, string values @@ -57,11 +50,11 @@ $arrays = array ( array("one" => 1, 2 => "two", 4 => "four"), //mixed // associative array, containing null/empty/boolean values as key/value -/*14*/ array(NULL => "NULL", null => "null", "NULL" => NULL, "null" => null), +/*14*/ array(true => "true", false => "false", "false" => false, "true" => true), array("" => "emptyd", '' => 'emptys', "emptyd" => "", 'emptys' => ''), - array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true), - array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6), + array(1 => '', 2 => "", 5 => false, 6 => true), + array('' => 1, "" => 2, false => 5, true => 6), // array with repetitive keys /*19*/ array("One" => 1, "two" => 2, "One" => 10, "two" => 20, "three" => 3) @@ -113,8 +106,10 @@ array(1) { array(6) { ["a "]=> string(3) "a " - ["aaaa "]=> - string(5) "aaaa " + ["aaaa +"]=> + string(5) "aaaa +" ["b"]=> string(1) "b" ["b bbb"]=> @@ -128,8 +123,8 @@ array(6) { array(6) { ["a\v\f"]=> string(5) "a\v\f" - ["aaaa\r"]=> - string(6) "aaaa\r" + ["aaaa\n"]=> + string(6) "aaaa\n" ["b"]=> string(1) "b" ["b\tbbb"]=> @@ -140,7 +135,7 @@ array(6) { string(28) "\[\]\!\@\#\$\%\^\&\*\(\)\{\}" } -- Iteration 8 -- -array(4) { +array(3) { [" "]=> string(1) " @@ -153,14 +148,6 @@ This is a double quoted string"]=> The quick brown fox jumped over; the lazy dog This is a double quoted string" - ["hello world -1111 != 2222 -heredoc -double quoted string. with different white spaces"]=> - string(88) "hello world -1111 != 2222 -heredoc -double quoted string. with different white spaces" ["11 < 12. 123 >22 'single quoted string' "double quoted string" @@ -220,13 +207,6 @@ array(3) { string(4) "four" } -- Iteration 14 -- -array(2) { - ["null"]=> - string(4) "null" - [""]=> - NULL -} --- Iteration 15 -- array(4) { ["true"]=> string(4) "true" @@ -237,30 +217,30 @@ array(4) { [1]=> bool(true) } --- Iteration 16 -- +-- Iteration 15 -- array(2) { ["emptys"]=> string(6) "emptys" [""]=> string(0) "" } --- Iteration 17 -- +-- Iteration 16 -- array(2) { [""]=> bool(false) [1]=> bool(true) } --- Iteration 18 -- +-- Iteration 17 -- array(3) { - [4]=> - int(4) + [2]=> + int(2) [5]=> int(5) [6]=> int(6) } --- Iteration 19 -- +-- Iteration 18 -- array(3) { [10]=> int(10) diff --git a/ext/standard/tests/array/array_combine_variation4.phpt b/ext/standard/tests/array/array_combine_variation4.phpt index 1ff6b64f175e5..993119edcedfe 100644 --- a/ext/standard/tests/array/array_combine_variation4.phpt +++ b/ext/standard/tests/array/array_combine_variation4.phpt @@ -9,9 +9,6 @@ Test array_combine() function : usage variations - associative array with differ */ echo "*** Testing array_combine() : assoc array with diff keys to both \$keys and \$values argument ***\n"; -// get an unset variable -$unset_var = 10; -unset ($unset_var); // get a resource variable $fp = fopen(__FILE__, "r"); @@ -24,11 +21,6 @@ class classA } } -// get a heredoc string -$heredoc = << 2.2, 'pen\n' => 33), array("\tHello" => 111, "re\td" => "color", "\v\fworld" => 2.2, "pen\n" => 33), - array("hello", $heredoc => "string"), // heredoc // array with object, unset variable and resource variable -/*10*/ array(@$unset_var => "hello", $fp => 'resource'), +/*10*/ array($fp => 'resource'), // array with mixed keys /*11*/ array('hello' => 1, "fruit" => 2.2, $fp => 'resource', 133 => "int", - @$unset_var => "unset", $heredoc => "heredoc") + ) ); // array to be passsed to $arr2 argument @@ -128,21 +119,12 @@ array(4) { int(33) } -- Iteration 7 -- -array(2) { - ["hello"]=> - string(5) "hello" - ["string"]=> - string(6) "string" -} --- Iteration 8 -- -array(2) { - ["hello"]=> - string(5) "hello" +array(1) { ["resource"]=> string(8) "resource" } --- Iteration 9 -- -array(6) { +-- Iteration 8 -- +array(4) { [1]=> int(1) ["2.2"]=> @@ -151,9 +133,5 @@ array(6) { string(8) "resource" ["int"]=> string(3) "int" - ["unset"]=> - string(5) "unset" - ["heredoc"]=> - string(7) "heredoc" } Done diff --git a/ext/standard/tests/array/array_diff_key_variation7.phpt b/ext/standard/tests/array/array_diff_key_variation7.phpt deleted file mode 100644 index 9ca74cccb9597..0000000000000 --- a/ext/standard/tests/array/array_diff_key_variation7.phpt +++ /dev/null @@ -1,52 +0,0 @@ ---TEST-- -Test array_diff_key() function : usage variation - Passing null,unset and undefined variable indexed array ---FILE-- - '10', "" => 'empty'); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -$input_arrays = array( - 'null indexed' => array(NULL => 'null 1', null => 'null 2'), - 'undefined indexed' => array(@$undefined_var => 'undefined'), - 'unset indexed' => array(@$unset_var => 'unset'), -); - -foreach($input_arrays as $key =>$value) { - echo "\n--$key--\n"; - // loop through each element of the array for arr1 - var_dump( array_diff_key($input_array, $value) ); - var_dump( array_diff_key($value, $input_array) ); -} -?> ---EXPECT-- -*** Testing array_diff_key() : usage variation *** - ---null indexed-- -array(1) { - [10]=> - string(2) "10" -} -array(0) { -} - ---undefined indexed-- -array(1) { - [10]=> - string(2) "10" -} -array(0) { -} - ---unset indexed-- -array(1) { - [10]=> - string(2) "10" -} -array(0) { -} diff --git a/ext/standard/tests/array/array_diff_uassoc_variation12.phpt b/ext/standard/tests/array/array_diff_uassoc_variation12.phpt deleted file mode 100644 index d5681c94cbdec..0000000000000 --- a/ext/standard/tests/array/array_diff_uassoc_variation12.phpt +++ /dev/null @@ -1,52 +0,0 @@ ---TEST-- -Test array_diff_uassoc() function : usage variation - Passing null,unset and undefined variable indexed array ---FILE-- - '10', "" => ''); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -$input_arrays = array( - 'null indexed' => array(NULL => NULL, null => null), - 'undefined indexed' => array(@$undefined_var => @$undefined_var), - 'unset indexed' => array(@$unset_var => @$unset_var), -); - -foreach($input_arrays as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_diff_uassoc($input_array, $value, "strcasecmp") ); - var_dump( array_diff_uassoc($value, $input_array, "strcasecmp") ); -} - -?> ---EXPECT-- -*** Testing array_diff_uassoc() : usage variation *** - ---null indexed-- -array(1) { - [10]=> - string(2) "10" -} -array(0) { -} - ---undefined indexed-- -array(1) { - [10]=> - string(2) "10" -} -array(0) { -} - ---unset indexed-- -array(1) { - [10]=> - string(2) "10" -} -array(0) { -} diff --git a/ext/standard/tests/array/array_diff_ukey_variation9.phpt b/ext/standard/tests/array/array_diff_ukey_variation9.phpt deleted file mode 100644 index 22cd3d45fdf84..0000000000000 --- a/ext/standard/tests/array/array_diff_ukey_variation9.phpt +++ /dev/null @@ -1,52 +0,0 @@ ---TEST-- -Test array_diff_ukey() function : usage variation - Passing null,unset and undefined variable indexed array ---FILE-- - '10', "" => 'empty'); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -$input_arrays = array( - 'null indexed' => array(NULL => 'null 1', null => 'null 2'), - 'undefined indexed' => array(@$undefined_var => 'undefined'), - 'unset indexed' => array(@$unset_var => 'unset'), -); - -foreach($input_arrays as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_diff_ukey($value, $input_array, 'strcasecmp') ); - var_dump( array_diff_ukey($input_array, $value, 'strcasecmp') ); -} - -?> ---EXPECT-- -*** Testing array_diff_ukey() : usage variation *** - ---null indexed-- -array(0) { -} -array(1) { - [10]=> - string(2) "10" -} - ---undefined indexed-- -array(0) { -} -array(1) { - [10]=> - string(2) "10" -} - ---unset indexed-- -array(0) { -} -array(1) { - [10]=> - string(2) "10" -} diff --git a/ext/standard/tests/array/array_fill_variation5.phpt b/ext/standard/tests/array/array_fill_variation5.phpt index f984a09675976..4f8b48d308382 100644 --- a/ext/standard/tests/array/array_fill_variation5.phpt +++ b/ext/standard/tests/array/array_fill_variation5.phpt @@ -23,10 +23,9 @@ $values = array( /* 5 */ array('color' => 'red' , 'item' => 'pen'), array( 'color' => 'red' , 2 => 'green ' ), array("colour" => "red" , "item" => "pen"), - array( TRUE => "red" , FALSE => "green" ), - array( true => "red" , FALSE => "green" ), + array( true => "red" , false => "green" ), /* 10 */ array( 1 => "Hi" , "color" => "red" , 'item' => 'pen'), - array( NULL => "Hi", '1' => "Hello" , "1" => "Green"), + array( '' => "Hi", '1' => "Hello" , "1" => "Green"), array( ""=>1, "color" => "green"), /* 13 */ array('Saffron' , 'White' , 'Green') ); @@ -191,23 +190,6 @@ array(2) { } } -- Iteration 9 -- -array(2) { - [0]=> - array(2) { - [1]=> - string(3) "red" - [0]=> - string(5) "green" - } - [1]=> - array(2) { - [1]=> - string(3) "red" - [0]=> - string(5) "green" - } -} --- Iteration 10 -- array(2) { [0]=> array(3) { @@ -228,7 +210,7 @@ array(2) { string(3) "pen" } } --- Iteration 11 -- +-- Iteration 10 -- array(2) { [0]=> array(2) { @@ -245,7 +227,7 @@ array(2) { string(5) "Green" } } --- Iteration 12 -- +-- Iteration 11 -- array(2) { [0]=> array(2) { @@ -262,7 +244,7 @@ array(2) { string(5) "green" } } --- Iteration 13 -- +-- Iteration 12 -- array(2) { [0]=> array(3) { diff --git a/ext/standard/tests/array/array_filter_variation3.phpt b/ext/standard/tests/array/array_filter_variation3.phpt index a81bb35951435..c5e6c121965b0 100644 --- a/ext/standard/tests/array/array_filter_variation3.phpt +++ b/ext/standard/tests/array/array_filter_variation3.phpt @@ -24,11 +24,10 @@ $input_values = array( array(0, 1, 2, -1, 034, 0X4A), // integer values array(0.0, 1.2, 1.2e3, 1.2e-3), // float values array('value1', "value2", '', " ", ""), // string values - array(true, false, TRUE, FALSE), // bool values - array(null, NULL), // null values + array(true, false), // bool values array(1 => 'one', 'zero' => 0, -2 => "value"), //associative array - array("one" => 1, null => 'null', 5 => "float", true => 1, "" => 'empty'), // associative array with different keys - array(1 => 'one', 2, "key" => 'value') // combinition of associative and non-associative array + array("one" => 1, 5 => "float", true => 1, "" => 'empty'), // associative array with different keys + array(1 => 'one', 2, "key" => 'value') // combination of associative and non-associative array ); @@ -119,36 +118,19 @@ array(5) { array(0) { } -- Iteration 4 -- -array(2) { +array(1) { [0]=> bool(true) - [2]=> - bool(true) } -array(4) { +array(2) { [0]=> bool(true) [1]=> bool(false) - [2]=> - bool(true) - [3]=> - bool(false) } array(0) { } -- Iteration 5 -- -array(0) { -} -array(2) { - [0]=> - NULL - [1]=> - NULL -} -array(0) { -} --- Iteration 6 -- array(2) { [1]=> string(3) "one" @@ -165,30 +147,30 @@ array(3) { } array(0) { } --- Iteration 7 -- +-- Iteration 6 -- array(4) { ["one"]=> int(1) - [""]=> - string(5) "empty" [5]=> string(5) "float" [1]=> int(1) + [""]=> + string(5) "empty" } array(4) { ["one"]=> int(1) - [""]=> - string(5) "empty" [5]=> string(5) "float" [1]=> int(1) + [""]=> + string(5) "empty" } array(0) { } --- Iteration 8 -- +-- Iteration 7 -- array(3) { [1]=> string(3) "one" diff --git a/ext/standard/tests/array/array_flip_variation2.phpt b/ext/standard/tests/array/array_flip_variation2.phpt index 9cf90905c15f9..bd433db9dd5a7 100644 --- a/ext/standard/tests/array/array_flip_variation2.phpt +++ b/ext/standard/tests/array/array_flip_variation2.phpt @@ -8,25 +8,12 @@ Test array_flip() function : usage variations - 'input' array with different key echo "*** Testing array_flip() : different keys for 'input' array argument ***\n"; -// different heredoc strings -$empty_heredoc = << 'int_key', // expected: value will be replaced by 'bool_key3' + 1 => 'int_key', // expected: value will be replaced by 'bool_key1' -2 => 'negative_key', 012 => 'octal_key', 0x34 => 'hex_key', @@ -41,21 +28,10 @@ $input = array( // bool keys true => 'bool_key1', false => 'bool_key2', - TRUE => 'bool_key3', - FALSE => 'bool_key4', - - // null keys - null => 'null_key1', // expected: value will be replaced by 'null_key2' - NULL => 'null_key2', // binary key "a".chr(0)."b" => 'binary_key1', b"binary" => 'binary_key2', - - //heredoc keys - $empty_heredoc => 'empty_heredoc', - $simple_heredoc => 'simple_heredoc', - $multiline_heredoc => 'multiline_heredoc', ); var_dump( array_flip($input) ); @@ -64,10 +40,10 @@ echo "Done" ?> --EXPECTF-- *** Testing array_flip() : different keys for 'input' array argument *** -array(13) { - ["bool_key4"]=> +array(11) { + ["bool_key2"]=> int(0) - ["bool_key3"]=> + ["bool_key1"]=> int(1) ["negative_key"]=> int(-2) @@ -79,7 +55,7 @@ array(13) { string(3) "key" ["string_key2"]=> string(3) "two" - ["empty_heredoc"]=> + ["string_key4"]=> string(0) "" ["string_key5"]=> string(1) " " @@ -87,11 +63,5 @@ array(13) { string(3) "a%0b" ["binary_key2"]=> string(6) "binary" - ["simple_heredoc"]=> - string(6) "simple" - ["multiline_heredoc"]=> - string(6%d) "multiline heredoc with 123 and -speci@! ch@r$...checking -and also" } Done diff --git a/ext/standard/tests/array/array_flip_variation5.phpt b/ext/standard/tests/array/array_flip_variation5.phpt index e7c47dffa5215..49876f35a82f3 100644 --- a/ext/standard/tests/array/array_flip_variation5.phpt +++ b/ext/standard/tests/array/array_flip_variation5.phpt @@ -3,39 +3,35 @@ Test array_flip() function : usage variations - 'input' argument with repeatitiv --FILE-- 'value', 2 => 'VALUE', 1 => "VaLuE", 3 => 4, 3 => 5); var_dump( array_flip($input) ); -// array with string key repeatition +// array with string key repetition $input = array("key" => 1, "two" => 'TWO', 'three' => 3, 'key' => "FOUR"); var_dump( array_flip($input) ); -// array with bool key repeatition +// array with bool key repetition $input = array(true => 1, false => 0, TRUE => -1); var_dump( array_flip($input) ); -// array with null key repeatition -$input = array(null => "Hello", NULL => 0); -var_dump( array_flip($input) ); - -// array with numeric value repeatition +// array with numeric value repetition $input = array('one' => 1, 'two' => 2, 3 => 1, "index" => 1); var_dump( array_flip($input) ); -//array with string value repeatition +//array with string value repetition $input = array('key1' => "value1", "key2" => '2', 'key3' => 'value1'); var_dump( array_flip($input) ); echo "Done" ?> --EXPECT-- -*** Testing array_flip() : 'input' array with repeatitive keys/values *** +*** Testing array_flip() : 'input' array with repetitive keys/values *** array(3) { ["VaLuE"]=> int(1) @@ -58,10 +54,6 @@ array(2) { [0]=> int(0) } -array(1) { - [0]=> - string(0) "" -} array(2) { [1]=> string(5) "index" diff --git a/ext/standard/tests/array/array_intersect_assoc_variation3.phpt b/ext/standard/tests/array/array_intersect_assoc_variation3.phpt index bb439a053bd28..532a79e688fa6 100644 --- a/ext/standard/tests/array/array_intersect_assoc_variation3.phpt +++ b/ext/standard/tests/array/array_intersect_assoc_variation3.phpt @@ -25,13 +25,6 @@ the lazy dog This is a double quoted string EOT; -// heredoc with different whitespaces -$diff_whitespaces = <<22 @@ -49,7 +42,7 @@ $arrays = array ( /*5*/ array(NULL), // with NULL array("a\v\f","aaaa\r","b","b\tbbb","c","\[\]\!\@\#\$\%\^\&\*\(\)\{\}"), // with double quoted strings array('a\v\f','aaaa\r','b','b\tbbb','c','\[\]\!\@\#\$\%\^\&\*\(\)\{\}'), // with single quoted strings - array("h1" => $blank_line, "h2" => $multiline_string, "h3" => $diff_whitespaces, $numeric_string), // with heredocs + array("h1" => $blank_line, "h2" => $multiline_string, $numeric_string), // with heredocs // associative arrays /*9*/ array(1 => "one", 2 => "two", 3 => "three"), // explicit numeric keys, string values @@ -59,11 +52,10 @@ $arrays = array ( array("one" => 1, 2 => "two", 4 => "four"), //mixed // associative array, containing null/empty/boolean values as key/value -/*14*/ array(NULL => "NULL", null => "null", "NULL" => NULL, "null" => null), - array(true => "true", false => "false", "false" => false, "true" => true), +/*14*/ array(true => "true", false => "false", "false" => false, "true" => true), array("" => "emptyd", '' => 'emptys', "emptyd" => "", 'emptys' => ''), array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true), - array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6), + array('' => 1, "" => 2, false => 5, true => 6), // array with repetitive keys /*19*/ array("One" => 1, "two" => 2, "One" => 10, "two" => 20, "three" => 3) @@ -74,9 +66,9 @@ $arrays = array ( $arr2 = array ( 1, 1.1, 2.2, "hello", "one", NULL, 2, 'world', true,5 => false, 1 => 'aaaa\r', "aaaa\r", - 'h3' => $diff_whitespaces, $numeric_string, + $numeric_string, "one" => "ten", 4 => "four", "two" => 2, - '', null => "null", '' => 'emptys', "emptyd" => "", + '', '' => 'emptys', "emptyd" => "", ); // loop through each sub-array within $arrays to check the behavior of array_intersect_assoc() @@ -141,19 +133,9 @@ array(1) { string(6) "aaaa\r" } -- Iteration 8 -- -array(1) { - ["h3"]=> - string(88) "hello world -1111 != 2222 -heredoc -double quoted string. with different white spaces" +array(0) { } -array(1) { - ["h3"]=> - string(88) "hello world -1111 != 2222 -heredoc -double quoted string. with different white spaces" +array(0) { } -- Iteration 9 -- array(0) { @@ -198,11 +180,6 @@ array(0) { array(0) { } -- Iteration 15 -- -array(0) { -} -array(0) { -} --- Iteration 16 -- array(2) { [""]=> string(6) "emptys" @@ -215,7 +192,7 @@ array(2) { ["emptyd"]=> string(0) "" } --- Iteration 17 -- +-- Iteration 16 -- array(1) { [5]=> bool(false) @@ -224,12 +201,12 @@ array(1) { [5]=> bool(false) } --- Iteration 18 -- +-- Iteration 17 -- array(0) { } array(0) { } --- Iteration 19 -- +-- Iteration 18 -- array(0) { } array(0) { diff --git a/ext/standard/tests/array/array_intersect_assoc_variation4.phpt b/ext/standard/tests/array/array_intersect_assoc_variation4.phpt index 859b7280d8ee4..91b64869c373a 100644 --- a/ext/standard/tests/array/array_intersect_assoc_variation4.phpt +++ b/ext/standard/tests/array/array_intersect_assoc_variation4.phpt @@ -25,13 +25,6 @@ the lazy dog This is a double quoted string EOT; -// heredoc with different whitespaces -$diff_whitespaces = <<22 @@ -40,13 +33,13 @@ $numeric_string = << true, "hello", "one", NULL, 2, 'world', true, false, 3 => "b\tbbb", "aaaa\r", - $numeric_string, "h3" => $diff_whitespaces, "true" => true, + $numeric_string, "true" => true, "one" => "ten", 4 => "four", "two" => 2, 6 => "six", - '', null => "null", '' => 'emptys' + '', '' => 'emptys' ); // arrays to be passed to $arr2 argument @@ -58,7 +51,7 @@ $arrays = array ( /*5*/ array(NULL), // array with NULL array("a\v\f","aaaa\r","b","b\tbbb","c","\[\]\!\@\#\$\%\^\&\*\(\)\{\}"), // array with double quoted strings array('a\v\f','aaaa\r','b','b\tbbb','c','\[\]\!\@\#\$\%\^\&\*\(\)\{\}'), // array with single quoted strings - array($blank_line, "h2" => $multiline_string, "h3" => $diff_whitespaces, $numeric_string), // array with heredocs + array($blank_line, "h2" => $multiline_string, $numeric_string), // array with heredocs // associative arrays /*9*/ array(1 => "one", 2 => "two", 6 => "six"), // explicit numeric keys, string values @@ -68,11 +61,10 @@ $arrays = array ( array("one" => 1, 2 => "two", 4 => "four"), //mixed // associative array, containing null/empty/boolean values as key/value -/*14*/ array(NULL => "NULL", null => "null", "NULL" => NULL, "null" => null), - array(true => "true", false => "false", "false" => false, "true" => true), +/*14*/ array(true => "true", false => "false", "false" => false, "true" => true), array("" => "emptyd", '' => 'emptys', "emptyd" => "", 'emptys' => ''), - array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true), - array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6), + array(1 => '', 2 => "", 5 => false, 6 => true), + array('' => 1, "" => 2, false => 5, true => 6), // array with repetitive keys /*19*/ array("One" => 1, "two" => 2, "One" => 10, "two" => 20, "three" => 3) @@ -148,19 +140,9 @@ array(0) { array(0) { } -- Iteration 8 -- -array(1) { - ["h3"]=> - string(88) "hello world -1111 != 2222 -heredoc -double quoted string. with different white spaces" +array(0) { } -array(1) { - ["h3"]=> - string(88) "hello world -1111 != 2222 -heredoc -double quoted string. with different white spaces" +array(0) { } -- Iteration 9 -- array(1) { @@ -204,11 +186,6 @@ array(1) { string(4) "four" } -- Iteration 14 -- -array(0) { -} -array(0) { -} --- Iteration 15 -- array(1) { ["true"]=> bool(true) @@ -217,7 +194,7 @@ array(1) { ["true"]=> bool(true) } --- Iteration 16 -- +-- Iteration 15 -- array(1) { [""]=> string(6) "emptys" @@ -226,7 +203,7 @@ array(1) { [""]=> string(6) "emptys" } --- Iteration 17 -- +-- Iteration 16 -- array(1) { [5]=> NULL @@ -235,12 +212,12 @@ array(1) { [5]=> NULL } --- Iteration 18 -- +-- Iteration 17 -- array(0) { } array(0) { } --- Iteration 19 -- +-- Iteration 18 -- array(0) { } array(0) { diff --git a/ext/standard/tests/array/array_intersect_assoc_variation5.phpt b/ext/standard/tests/array/array_intersect_assoc_variation5.phpt index 65ce1dae17d13..64cfdbb529407 100644 --- a/ext/standard/tests/array/array_intersect_assoc_variation5.phpt +++ b/ext/standard/tests/array/array_intersect_assoc_variation5.phpt @@ -10,10 +10,6 @@ Test array_intersect_assoc() function : usage variations - assoc array with diff echo "*** Testing array_intersect_assoc() : assoc array with diff keys to \$arr1 argument ***\n"; -// get an unset variable -$unset_var = 10; -unset ($unset_var); - // get a heredoc string $heredoc = << 2.2, "pen\n" => 33), array("hello", $heredoc => "string"), // heredoc - // array with object, unset variable and resource variable -/*10*/ array(@$unset_var => "hello"), - // array with mixed keys /*11*/ array('hello' => 1, "fruit" => 2.2, 133 => "int", - @$unset_var => "unset", $heredoc => "heredoc") + $heredoc => "heredoc") ); // array to be passed to $arr2 argument @@ -123,11 +116,6 @@ array(1) { string(6) "string" } -- Iteration 8 -- -array(0) { -} -array(0) { -} --- Iteration 9 -- array(1) { [133]=> string(3) "int" diff --git a/ext/standard/tests/array/array_intersect_assoc_variation6.phpt b/ext/standard/tests/array/array_intersect_assoc_variation6.phpt index f446c6870419d..92664a83b79da 100644 --- a/ext/standard/tests/array/array_intersect_assoc_variation6.phpt +++ b/ext/standard/tests/array/array_intersect_assoc_variation6.phpt @@ -10,10 +10,6 @@ Test array_intersect_assoc() function : usage variations - assoc array with diff echo "*** Testing array_intersect_assoc() : assoc array with diff keys to \$arr2 argument ***\n"; -// get an unset variable -$unset_var = 10; -unset ($unset_var); - // get a heredoc string $heredoc = << "string"), // heredoc // array with unset variable -/*10*/ array( @$unset_var => "hello"), // array with mixed keys /*11*/ array('hello' => 1, "fruit" => 2.2, 133 => "int", - @$unset_var => "unset", $heredoc => "heredoc") + $heredoc => "heredoc") ); // array to be passed to $arr1 argument @@ -123,11 +118,6 @@ array(1) { string(6) "string" } -- Iteration 8 -- -array(0) { -} -array(0) { -} --- Iteration 9 -- array(1) { [133]=> string(3) "int" diff --git a/ext/standard/tests/array/array_intersect_key_variation7.phpt b/ext/standard/tests/array/array_intersect_key_variation7.phpt deleted file mode 100644 index 2b6ead7919adb..0000000000000 --- a/ext/standard/tests/array/array_intersect_key_variation7.phpt +++ /dev/null @@ -1,56 +0,0 @@ ---TEST-- -Test array_intersect_key() function : usage variation - Passing null,unset and undefeined variable indexed array ---FILE-- - '0', 1 => '1' , -10 => '-10' , null => 'null'); -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -$input_arrays = array( - 'null indexed' => array(NULL => 'null 1', null => 'null 2'), - 'undefined indexed' => array(@$undefined_var => 'undefined'), - 'unset indexed' => array(@$unset_var => 'unset'), -); - -foreach($input_arrays as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_intersect_key($input_array, $value) ); - var_dump( array_intersect_key($value,$input_array ) ); -} -?> ---EXPECT-- -*** Testing array_intersect_key() : usage variation *** - ---null indexed-- -array(1) { - [""]=> - string(4) "null" -} -array(1) { - [""]=> - string(6) "null 2" -} - ---undefined indexed-- -array(1) { - [""]=> - string(4) "null" -} -array(1) { - [""]=> - string(9) "undefined" -} - ---unset indexed-- -array(1) { - [""]=> - string(4) "null" -} -array(1) { - [""]=> - string(5) "unset" -} diff --git a/ext/standard/tests/array/array_intersect_variation3.phpt b/ext/standard/tests/array/array_intersect_variation3.phpt index 1f3258ae8326b..05584ae0a49ce 100644 --- a/ext/standard/tests/array/array_intersect_variation3.phpt +++ b/ext/standard/tests/array/array_intersect_variation3.phpt @@ -25,13 +25,6 @@ the lazy dog This is a double quoted string EOT; -// heredoc with different whitespaces -$diff_whitespaces = <<22 @@ -47,9 +40,9 @@ $arrays = array ( array(false,true), // array with default keys and boolean values array(), // empty array /*5*/ array(NULL), // array with NULL - array("a\v\f","aaaa\r","b","b\tbbb","c","\[\]\!\@\#\$\%\^\&\*\(\)\{\}"), // array with double quoted strings - array('a\v\f','aaaa\r','b','b\tbbb','c','\[\]\!\@\#\$\%\^\&\*\(\)\{\}'), // array with single quoted strings - array($blank_line, $multiline_string, $diff_whitespaces, $numeric_string), // array with heredocs + array("a\v\f","aaaa\n","b","b\tbbb","c","\[\]\!\@\#\$\%\^\&\*\(\)\{\}"), // array with double quoted strings + array('a\v\f','aaaa\n','b','b\tbbb','c','\[\]\!\@\#\$\%\^\&\*\(\)\{\}'), // array with single quoted strings + array($blank_line, $multiline_string, $numeric_string), // array with heredocs // associative arrays /*9*/ array(1 => "one", 2 => "two", 3 => "three"), // explicit numeric keys, string values @@ -58,25 +51,24 @@ $arrays = array ( array( "one" => "ten", "two" => "twenty", "three" => "thirty"), // string key/value array("one" => 1, 2 => "two", 4 => "four"), //mixed - // associative array, containing null/empty/boolean values as key/value -/*14*/ array(NULL => "NULL", null => "null", "NULL" => NULL, "null" => null), - array(true => "true", false => "false", "false" => false, "true" => true), + // associative array, containing empty/boolean values as key/value +/*14*/ array(true => "true", false => "false", "false" => false, "true" => true), array("" => "emptyd", '' => 'emptys', "emptyd" => "", 'emptys' => ''), - array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true), - array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6), + array(1 => '', 2 => "", 5 => false, 6 => true), + array('' => 1, "" => 2, false => 5, true => 6), // array with repetitive keys /*19*/ array("One" => 1, "two" => 2, "One" => 10, "two" => 20, "three" => 3) ); -// array to be passsed to $arr2 argument +// array to be passed to $arr2 argument $arr2 = array ( 1, 1.1, "hello", "one", NULL, 2, - 'world', true, false, false => 5, 'aaaa\r', "aaaa\r", - $numeric_string, $diff_whitespaces, + 'world', true, false, false => 5, 'aaaa\n', "aaaa\n", + $numeric_string, "one" => "ten", 4 => "four", "two" => 2, 2 => "two", - '', null => "null", '' => 'emptys' + '', '' => 'emptys' ); // loop through each sub-array within $arrays to check the behavior of array_intersect() @@ -149,42 +141,34 @@ array(1) { -- Iterator 6 -- array(1) { [1]=> - string(5) "aaaa " + string(5) "aaaa +" } array(1) { [1]=> - string(5) "aaaa " + string(5) "aaaa +" } -- Iterator 7 -- array(1) { [1]=> - string(6) "aaaa\r" + string(6) "aaaa\n" } array(1) { [1]=> - string(6) "aaaa\r" + string(6) "aaaa\n" } -- Iterator 8 -- -array(2) { +array(1) { [2]=> - string(88) "hello world -1111 != 2222 -heredoc -double quoted string. with different white spaces" - [3]=> string(90) "11 < 12. 123 >22 'single quoted string' "double quoted string" 2222 != 1111. 0000 = 0000 " } -array(2) { +array(1) { [2]=> - string(88) "hello world -1111 != 2222 -heredoc -double quoted string. with different white spaces" - [3]=> string(90) "11 < 12. 123 >22 'single quoted string' "double quoted string" @@ -249,19 +233,6 @@ array(3) { string(4) "four" } -- Iterator 14 -- -array(2) { - ["NULL"]=> - NULL - ["null"]=> - NULL -} -array(2) { - ["NULL"]=> - NULL - ["null"]=> - NULL -} --- Iterator 15 -- array(2) { ["false"]=> bool(false) @@ -274,7 +245,7 @@ array(2) { ["true"]=> bool(true) } --- Iterator 16 -- +-- Iterator 15 -- array(3) { [""]=> string(6) "emptys" @@ -291,45 +262,41 @@ array(3) { ["emptys"]=> string(0) "" } --- Iterator 17 -- -array(6) { +-- Iterator 16 -- +array(4) { [1]=> string(0) "" [2]=> string(0) "" - [3]=> - NULL - [4]=> - NULL [5]=> bool(false) [6]=> bool(true) } -array(6) { +array(4) { [1]=> string(0) "" [2]=> string(0) "" - [3]=> - NULL - [4]=> - NULL [5]=> bool(false) [6]=> bool(true) } --- Iterator 18 -- -array(1) { +-- Iterator 17 -- +array(2) { + [""]=> + int(2) [0]=> int(5) } -array(1) { +array(2) { + [""]=> + int(2) [0]=> int(5) } --- Iterator 19 -- +-- Iterator 18 -- array(0) { } array(0) { diff --git a/ext/standard/tests/array/array_intersect_variation4.phpt b/ext/standard/tests/array/array_intersect_variation4.phpt index ce0fa47b03f38..cb41dcd029049 100644 --- a/ext/standard/tests/array/array_intersect_variation4.phpt +++ b/ext/standard/tests/array/array_intersect_variation4.phpt @@ -25,13 +25,6 @@ the lazy dog This is a double quoted string EOT; -// heredoc with different whitespaces -$diff_whitespaces = <<22 @@ -43,10 +36,10 @@ EOT; // array to be passsed to $arr1 argument $arr1 = array ( 1, 1.1, "hello", "one", NULL, 2, - 'world', true, false, false => 5, 'aaaa\r', "aaaa\r", - $numeric_string, $diff_whitespaces, + 'world', true, false, false => 5, 'aaaa\n', "aaaa\n", + $numeric_string, "one" => "ten", 4 => "four", "two" => 2, 2 => "two", - '', null => "null", '' => 'emptys' + '', '' => 'emptys' ); // arrays to be passed to $arr2 argument @@ -56,9 +49,9 @@ $arrays = array ( array(false,true), // array with default keys and boolean values array(), // empty array /*5*/ array(NULL), // array with NULL - array("a\v\f","aaaa\r","b","b\tbbb","c","\[\]\!\@\#\$\%\^\&\*\(\)\{\}"), // array with double quoted strings - array('a\v\f','aaaa\r','b','b\tbbb','c','\[\]\!\@\#\$\%\^\&\*\(\)\{\}'), // array with single quoted strings - array($blank_line, $multiline_string, $diff_whitespaces, $numeric_string), // array with heredocs + array("a\v\f","aaaa\n","b","b\tbbb","c","\[\]\!\@\#\$\%\^\&\*\(\)\{\}"), // array with double quoted strings + array('a\v\f','aaaa\n','b','b\tbbb','c','\[\]\!\@\#\$\%\^\&\*\(\)\{\}'), // array with single quoted strings + array($blank_line, $multiline_string, $numeric_string), // array with heredocs // associative arrays /*9*/ array(1 => "one", 2 => "two", 3 => "three"), // explicit numeric keys, string values @@ -68,11 +61,11 @@ $arrays = array ( array("one" => 1, 2 => "two", 4 => "four"), //mixed // associative array, containing null/empty/boolean values as key/value -/*14*/ array(NULL => "NULL", null => "null", "NULL" => NULL, "null" => null), +/*14*/ array(true => "true", false => "false", "false" => false, "true" => true), array("" => "emptyd", '' => 'emptys', "emptyd" => "", 'emptys' => ''), - array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true), - array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6), + array(1 => '', 2 => "", 5 => false, 6 => true), + array('' => 1, "" => 2, false => 5, true => 6), // array with repetitive keys /*19*/ array("One" => 1, "two" => 2, "One" => 10, "two" => 20, "three" => 3) @@ -128,7 +121,7 @@ array(3) { bool(true) [8]=> bool(false) - [13]=> + [12]=> string(0) "" } array(3) { @@ -136,7 +129,7 @@ array(3) { bool(true) [8]=> bool(false) - [13]=> + [12]=> string(0) "" } -- Iteration 4 -- @@ -148,59 +141,51 @@ array(0) { array(2) { [8]=> bool(false) - [13]=> + [12]=> string(0) "" } array(2) { [8]=> bool(false) - [13]=> + [12]=> string(0) "" } -- Iteration 6 -- array(1) { [10]=> - string(5) "aaaa " + string(5) "aaaa +" } array(1) { [10]=> - string(5) "aaaa " + string(5) "aaaa +" } -- Iteration 7 -- array(1) { [9]=> - string(6) "aaaa\r" + string(6) "aaaa\n" } array(1) { [9]=> - string(6) "aaaa\r" + string(6) "aaaa\n" } -- Iteration 8 -- -array(2) { +array(1) { [11]=> string(90) "11 < 12. 123 >22 'single quoted string' "double quoted string" 2222 != 1111. 0000 = 0000 " - [12]=> - string(88) "hello world -1111 != 2222 -heredoc -double quoted string. with different white spaces" } -array(2) { +array(1) { [11]=> string(90) "11 < 12. 123 >22 'single quoted string' "double quoted string" 2222 != 1111. 0000 = 0000 " - [12]=> - string(88) "hello world -1111 != 2222 -heredoc -double quoted string. with different white spaces" } -- Iteration 9 -- array(2) { @@ -264,25 +249,12 @@ array(3) { bool(true) } -- Iteration 14 -- -array(2) { - [8]=> - bool(false) - [13]=> - string(0) "" -} -array(2) { - [8]=> - bool(false) - [13]=> - string(0) "" -} --- Iteration 15 -- array(3) { [7]=> bool(true) [8]=> bool(false) - [13]=> + [12]=> string(0) "" } array(3) { @@ -290,14 +262,14 @@ array(3) { bool(true) [8]=> bool(false) - [13]=> + [12]=> string(0) "" } --- Iteration 16 -- +-- Iteration 15 -- array(3) { [8]=> bool(false) - [13]=> + [12]=> string(0) "" [""]=> string(6) "emptys" @@ -305,18 +277,18 @@ array(3) { array(3) { [8]=> bool(false) - [13]=> + [12]=> string(0) "" [""]=> string(6) "emptys" } --- Iteration 17 -- +-- Iteration 16 -- array(3) { [7]=> bool(true) [8]=> bool(false) - [13]=> + [12]=> string(0) "" } array(3) { @@ -324,19 +296,27 @@ array(3) { bool(true) [8]=> bool(false) - [13]=> + [12]=> string(0) "" } --- Iteration 18 -- -array(1) { +-- Iteration 17 -- +array(3) { [0]=> int(5) + [5]=> + int(2) + ["two"]=> + int(2) } -array(1) { +array(3) { [0]=> int(5) + [5]=> + int(2) + ["two"]=> + int(2) } --- Iteration 19 -- +-- Iteration 18 -- array(0) { } array(0) { diff --git a/ext/standard/tests/array/array_intersect_variation5.phpt b/ext/standard/tests/array/array_intersect_variation5.phpt index 12edea88196e6..f394a030bd78e 100644 --- a/ext/standard/tests/array/array_intersect_variation5.phpt +++ b/ext/standard/tests/array/array_intersect_variation5.phpt @@ -10,10 +10,6 @@ Test array_intersect() function : usage variations - assoc array with diff keys echo "*** Testing array_intersect() : assoc array with diff keys to \$arr1 argument ***\n"; -// get an unset variable -$unset_var = 10; -unset ($unset_var); - // get a heredoc string $heredoc = << 2.2, "pen\n" => 33), array("hello", $heredoc => "string"), // heredoc - // array with unset variable -/*10*/ array( @$unset_var => "hello"), - // array with mixed keys /*11*/ array('hello' => 1, "fruit" => 2.2, 133 => "int", - @$unset_var => "unset", $heredoc => "heredoc") + $heredoc => "heredoc") ); // array to be passed to $arr2 argument @@ -135,15 +128,6 @@ array(2) { string(6) "string" } -- Iterator 8 -- -array(1) { - [""]=> - string(5) "hello" -} -array(1) { - [""]=> - string(5) "hello" -} --- Iterator 9 -- array(2) { ["hello"]=> int(1) diff --git a/ext/standard/tests/array/array_intersect_variation6.phpt b/ext/standard/tests/array/array_intersect_variation6.phpt index 93ff4271d70a9..7bad0b25b9580 100644 --- a/ext/standard/tests/array/array_intersect_variation6.phpt +++ b/ext/standard/tests/array/array_intersect_variation6.phpt @@ -10,10 +10,6 @@ Test array_intersect() function : usage variations - assoc array with diff keys echo "*** Testing array_intersect() : assoc array with diff keys to \$arr2 argument ***\n"; -// get an unset variable -$unset_var = 10; -unset ($unset_var); - // get a heredoc string $heredoc = << 2.2, "pen\n" => 33), array("hello", $heredoc => "string"), // heredoc - // array with unset variable -/*10*/ array( @$unset_var => "hello"), - // array with mixed keys /*11*/ array('hello' => 1, "fruit" => 2.2, 133 => "int", - @$unset_var => "unset", $heredoc => "heredoc") + $heredoc => "heredoc") ); // array to be passed to $arr1 argument @@ -135,15 +128,6 @@ array(2) { string(6) "string" } -- Iterator 8 -- -array(1) { - [3]=> - string(5) "hello" -} -array(1) { - [3]=> - string(5) "hello" -} --- Iterator 9 -- array(2) { [0]=> int(1) diff --git a/ext/standard/tests/array/array_key_exists.phpt b/ext/standard/tests/array/array_key_exists.phpt index c0db558f25823..92373b04bb450 100644 --- a/ext/standard/tests/array/array_key_exists.phpt +++ b/ext/standard/tests/array/array_key_exists.phpt @@ -44,7 +44,7 @@ $search_arrays_v = array ( array(), array(NULL), array(array(), 1, 2), - array(1,2,3, "" => "value", NULL => "value", true => "value" ), + array(1,2,3, "" => "value", true => "value" ), array( array(2,4,5), array ("a","b","d") ) ); // search for $key_variations in each sub array of $search_arrays_v diff --git a/ext/standard/tests/array/array_key_exists_variation8.phpt b/ext/standard/tests/array/array_key_exists_variation8.phpt index 417b56aae8453..23a7212bbae1d 100644 --- a/ext/standard/tests/array/array_key_exists_variation8.phpt +++ b/ext/standard/tests/array/array_key_exists_variation8.phpt @@ -10,10 +10,6 @@ Test array_key_exists() function : usage variations - array keys are different d echo "*** Testing array_key_exists() : usage variations ***\n"; -//get an unset variable -$unset_var = 10; -unset ($unset_var); - // heredoc string $heredoc = << 'negative', ), - // null data -/*3*/ 'null uppercase' => array( - NULL => 'null 1', - ), - 'null lowercase' => array( - null => 'null 2', - ), - // boolean data /*4*/ 'bool lowercase' => array( true => 'lowert', false => 'lowerf', ), - 'bool uppercase' => array( - TRUE => 'uppert', - FALSE => 'upperf', - ), // empty data -/*5*/ 'empty double quotes' => array( - "" => 'emptyd', - ), - 'empty single quotes' => array( +/*5*/ 'empty single quotes' => array( '' => 'emptys', ), @@ -62,22 +43,12 @@ $inputs = array( 'strings' => 'strings', $heredoc => 'stringh', ), - - // undefined data -/*8*/ 'undefined' => array( - @$undefined_var => 'undefined', - ), - - // unset data -/*9*/ 'unset' => array( - @$unset_var => 'unset', - ), ); // loop through each element of $inputs to check the behavior of array_key_exists() $iterator = 1; foreach($inputs as $type => $input) { - echo "\n-- Iteration $iterator: $type data --\n"; + echo "\n-- $type data --\n"; //iterate over again to get all different key values foreach ($inputs as $new_type => $new_input) { @@ -94,293 +65,67 @@ echo "Done"; --EXPECT-- *** Testing array_key_exists() : usage variations *** --- Iteration 1: int data -- +-- int data -- -- $key arguments are int data: bool(true) bool(true) bool(true) bool(true) --- $key arguments are null uppercase data: -bool(false) --- $key arguments are null lowercase data: -bool(false) -- $key arguments are bool lowercase data: bool(true) bool(true) --- $key arguments are bool uppercase data: -bool(true) -bool(true) --- $key arguments are empty double quotes data: -bool(false) -- $key arguments are empty single quotes data: bool(false) -- $key arguments are string data: bool(false) bool(false) bool(false) --- $key arguments are undefined data: -bool(false) --- $key arguments are unset data: -bool(false) --- Iteration 2: null uppercase data -- +-- bool lowercase data -- -- $key arguments are int data: -bool(false) -bool(false) -bool(false) -bool(false) --- $key arguments are null uppercase data: -bool(true) --- $key arguments are null lowercase data: -bool(true) --- $key arguments are bool lowercase data: -bool(false) -bool(false) --- $key arguments are bool uppercase data: -bool(false) -bool(false) --- $key arguments are empty double quotes data: -bool(true) --- $key arguments are empty single quotes data: -bool(true) --- $key arguments are string data: -bool(false) -bool(false) -bool(false) --- $key arguments are undefined data: -bool(true) --- $key arguments are unset data: -bool(true) - --- Iteration 3: null lowercase data -- --- $key arguments are int data: -bool(false) -bool(false) -bool(false) -bool(false) --- $key arguments are null uppercase data: bool(true) --- $key arguments are null lowercase data: bool(true) --- $key arguments are bool lowercase data: -bool(false) -bool(false) --- $key arguments are bool uppercase data: -bool(false) -bool(false) --- $key arguments are empty double quotes data: -bool(true) --- $key arguments are empty single quotes data: -bool(true) --- $key arguments are string data: -bool(false) -bool(false) -bool(false) --- $key arguments are undefined data: -bool(true) --- $key arguments are unset data: -bool(true) - --- Iteration 4: bool lowercase data -- --- $key arguments are int data: -bool(true) -bool(true) -bool(false) -bool(false) --- $key arguments are null uppercase data: -bool(false) --- $key arguments are null lowercase data: -bool(false) --- $key arguments are bool lowercase data: -bool(true) -bool(true) --- $key arguments are bool uppercase data: -bool(true) -bool(true) --- $key arguments are empty double quotes data: -bool(false) --- $key arguments are empty single quotes data: -bool(false) --- $key arguments are string data: -bool(false) -bool(false) -bool(false) --- $key arguments are undefined data: -bool(false) --- $key arguments are unset data: -bool(false) - --- Iteration 5: bool uppercase data -- --- $key arguments are int data: -bool(true) -bool(true) -bool(false) -bool(false) --- $key arguments are null uppercase data: bool(false) --- $key arguments are null lowercase data: bool(false) -- $key arguments are bool lowercase data: bool(true) bool(true) --- $key arguments are bool uppercase data: -bool(true) -bool(true) --- $key arguments are empty double quotes data: -bool(false) -- $key arguments are empty single quotes data: bool(false) -- $key arguments are string data: bool(false) bool(false) bool(false) --- $key arguments are undefined data: -bool(false) --- $key arguments are unset data: -bool(false) --- Iteration 6: empty double quotes data -- +-- empty single quotes data -- -- $key arguments are int data: bool(false) bool(false) bool(false) bool(false) --- $key arguments are null uppercase data: -bool(true) --- $key arguments are null lowercase data: -bool(true) -- $key arguments are bool lowercase data: bool(false) bool(false) --- $key arguments are bool uppercase data: -bool(false) -bool(false) --- $key arguments are empty double quotes data: -bool(true) -- $key arguments are empty single quotes data: bool(true) -- $key arguments are string data: bool(false) bool(false) bool(false) --- $key arguments are undefined data: -bool(true) --- $key arguments are unset data: -bool(true) --- Iteration 7: empty single quotes data -- +-- string data -- -- $key arguments are int data: bool(false) bool(false) bool(false) bool(false) --- $key arguments are null uppercase data: -bool(true) --- $key arguments are null lowercase data: -bool(true) -- $key arguments are bool lowercase data: bool(false) bool(false) --- $key arguments are bool uppercase data: -bool(false) -bool(false) --- $key arguments are empty double quotes data: -bool(true) --- $key arguments are empty single quotes data: -bool(true) --- $key arguments are string data: -bool(false) -bool(false) -bool(false) --- $key arguments are undefined data: -bool(true) --- $key arguments are unset data: -bool(true) - --- Iteration 8: string data -- --- $key arguments are int data: -bool(false) -bool(false) -bool(false) -bool(false) --- $key arguments are null uppercase data: -bool(false) --- $key arguments are null lowercase data: -bool(false) --- $key arguments are bool lowercase data: -bool(false) -bool(false) --- $key arguments are bool uppercase data: -bool(false) -bool(false) --- $key arguments are empty double quotes data: -bool(false) -- $key arguments are empty single quotes data: bool(false) -- $key arguments are string data: bool(true) bool(true) bool(true) --- $key arguments are undefined data: -bool(false) --- $key arguments are unset data: -bool(false) - --- Iteration 9: undefined data -- --- $key arguments are int data: -bool(false) -bool(false) -bool(false) -bool(false) --- $key arguments are null uppercase data: -bool(true) --- $key arguments are null lowercase data: -bool(true) --- $key arguments are bool lowercase data: -bool(false) -bool(false) --- $key arguments are bool uppercase data: -bool(false) -bool(false) --- $key arguments are empty double quotes data: -bool(true) --- $key arguments are empty single quotes data: -bool(true) --- $key arguments are string data: -bool(false) -bool(false) -bool(false) --- $key arguments are undefined data: -bool(true) --- $key arguments are unset data: -bool(true) - --- Iteration 10: unset data -- --- $key arguments are int data: -bool(false) -bool(false) -bool(false) -bool(false) --- $key arguments are null uppercase data: -bool(true) --- $key arguments are null lowercase data: -bool(true) --- $key arguments are bool lowercase data: -bool(false) -bool(false) --- $key arguments are bool uppercase data: -bool(false) -bool(false) --- $key arguments are empty double quotes data: -bool(true) --- $key arguments are empty single quotes data: -bool(true) --- $key arguments are string data: -bool(false) -bool(false) -bool(false) --- $key arguments are undefined data: -bool(true) --- $key arguments are unset data: -bool(true) Done diff --git a/ext/standard/tests/array/array_key_first.phpt b/ext/standard/tests/array/array_key_first.phpt index d3360f6bfe9fc..c0aa1d770097e 100644 --- a/ext/standard/tests/array/array_key_first.phpt +++ b/ext/standard/tests/array/array_key_first.phpt @@ -15,7 +15,7 @@ $mixed_array = array( array( "1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five" ), array( 1 => "one", 2 => "two", 3 => 7, 4 => "four", 5 => "five" ), array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2 => "float", "F" => "FFF", - "blank" => "", 3 => 3.7, 5 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ), + "blank" => "", 3 => 3.7, 5 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL ), array( 12, "name", 'age', '45' ), array( array("oNe", "tWo", 4), array(10, 20, 30, 40, 50), array() ), array( "one" => 1, "one" => 2, "three" => 3, 3, 4, 3 => 33, 4 => 44, 5, 6, @@ -174,7 +174,7 @@ array(12) { [4]=> int(6) [""]=> - int(3) + string(5) "blank" [2]=> string(5) "float" ["F"]=> diff --git a/ext/standard/tests/array/array_key_last.phpt b/ext/standard/tests/array/array_key_last.phpt index c325be6560029..14c4bfe9a2e69 100644 --- a/ext/standard/tests/array/array_key_last.phpt +++ b/ext/standard/tests/array/array_key_last.phpt @@ -15,7 +15,7 @@ $mixed_array = array( array( "1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five" ), array( 1 => "one", 2 => "two", 3 => 7, 4 => "four", 5 => "five" ), array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2 => "float", "F" => "FFF", - "blank" => "", 3 => 3.7, 5 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ), + "blank" => "", 3 => 3.7, 5 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL ), array( 12, "name", 'age', '45' ), array( array("oNe", "tWo", 4), array(10, 20, 30, 40, 50), array() ), array( "one" => 1, "one" => 2, "three" => 3, 3, 4, 3 => 33, 4 => 44, 5, 6, @@ -174,7 +174,7 @@ array(12) { [4]=> int(6) [""]=> - int(3) + string(5) "blank" [2]=> string(5) "float" ["F"]=> diff --git a/ext/standard/tests/array/array_keys_variation_001.phpt b/ext/standard/tests/array/array_keys_variation_001.phpt index fdba88afbdd5f..4727beefa073e 100644 --- a/ext/standard/tests/array/array_keys_variation_001.phpt +++ b/ext/standard/tests/array/array_keys_variation_001.phpt @@ -14,7 +14,7 @@ $arrays = array( array("a" => 1, "b" => 2, "c" =>3, "d" => array()), array(0 => 0, 1 => 1, 2 => 2, 3 => 3), array(0 =>3.000, 1 =>2, 1 =>3, "a"=>3, 3=>5, "5"=>3.000), - array(TRUE => TRUE, FALSE => FALSE, NULL => NULL, "\x000", "\000"), + array(TRUE => TRUE, FALSE => FALSE, "\x000", "\000"), array("a" => "abcd", "a" => "", "ab" => -6, "cd" => -0.5 ), array(0 => array(), 1=> array(0), 2 => array(1), ""=> array(),""=>"" ) ); @@ -110,16 +110,14 @@ array(5) { } -- Iteration 9 -- -array(5) { +array(4) { [0]=> int(1) [1]=> int(0) [2]=> - string(0) "" - [3]=> int(2) - [4]=> + [3]=> int(3) } diff --git a/ext/standard/tests/array/array_map_variation3.phpt b/ext/standard/tests/array/array_map_variation3.phpt index e252c5a7c5a5f..10b1793df0252 100644 --- a/ext/standard/tests/array/array_map_variation3.phpt +++ b/ext/standard/tests/array/array_map_variation3.phpt @@ -31,11 +31,11 @@ $arrays = array ( array("one" => 1, 2 => "two", 4 => "four"), //mixed // associative array, containing null/empty/boolean values as key/value -/*13*/ array(NULL => "NULL", null => "null", "NULL" => NULL, "null" => null), +/*13*/ array(true => "true", false => "false", "false" => false, "true" => true), array("" => "emptyd", '' => 'emptys', "emptyd" => "", 'emptys' => ''), - array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true), - array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6), + array(1 => '', 2 => "", 5 => false, 6 => true), + array('' => 1, "" => 2, false => 5, true => 6), // array with repetitive keys /*18*/ array("One" => 1, "two" => 2, "One" => 10, "two" => 20, "three" => 3) @@ -158,15 +158,6 @@ array(3) { string(4) "four" } -- Iteration 13 -- -array(3) { - [""]=> - string(4) "null" - ["NULL"]=> - NULL - ["null"]=> - NULL -} --- Iteration 14 -- array(4) { [1]=> string(4) "true" @@ -177,7 +168,7 @@ array(4) { ["true"]=> bool(true) } --- Iteration 15 -- +-- Iteration 14 -- array(3) { [""]=> string(6) "emptys" @@ -186,31 +177,27 @@ array(3) { ["emptys"]=> string(0) "" } --- Iteration 16 -- -array(6) { +-- Iteration 15 -- +array(4) { [1]=> string(0) "" [2]=> string(0) "" - [3]=> - NULL - [4]=> - NULL [5]=> bool(false) [6]=> bool(true) } --- Iteration 17 -- +-- Iteration 16 -- array(3) { [""]=> - int(4) + int(2) [0]=> int(5) [1]=> int(6) } --- Iteration 18 -- +-- Iteration 17 -- array(3) { ["One"]=> int(10) diff --git a/ext/standard/tests/array/array_map_variation4.phpt b/ext/standard/tests/array/array_map_variation4.phpt index d75a0bcf26108..2062588fc4e51 100644 --- a/ext/standard/tests/array/array_map_variation4.phpt +++ b/ext/standard/tests/array/array_map_variation4.phpt @@ -46,12 +46,12 @@ $arrays = array ( array("hello", $heredoc => "string"), // heredoc // array with object, unset variable and resource variable - array(@$unset_var => "hello", STDERR => 'resource'), + array(STDERR => 'resource'), // array with mixed values /*11*/ array('hello' => 1, "fruit" => 2.2, STDERR => 'resource', 133 => "int", - @$unset_var => "unset", $heredoc => "heredoc") + $heredoc => "heredoc") ); // loop through the various elements of $arrays to test array_map() @@ -125,14 +125,12 @@ array(2) { string(6) "string" } -- Iteration 8 -- -array(2) { - [""]=> - string(5) "hello" +array(1) { [3]=> string(8) "resource" } -- Iteration 9 -- -array(6) { +array(5) { ["hello"]=> int(1) ["fruit"]=> @@ -141,8 +139,6 @@ array(6) { string(8) "resource" [133]=> string(3) "int" - [""]=> - string(5) "unset" ["Hello world"]=> string(7) "heredoc" } diff --git a/ext/standard/tests/array/array_map_variation7.phpt b/ext/standard/tests/array/array_map_variation7.phpt index 30e6f9d91d613..811219b6bb83d 100644 --- a/ext/standard/tests/array/array_map_variation7.phpt +++ b/ext/standard/tests/array/array_map_variation7.phpt @@ -27,7 +27,7 @@ var_dump( array_map('callback', array(), array(1, 2, 3), array('a', 'b')) ); // echo "Done"; ?> ---EXPECT-- +--EXPECTF-- *** Testing array_map() : arrays with diff. size *** array(3) { [0]=> @@ -46,6 +46,12 @@ array(3) { NULL } } + +Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d + +Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d + +Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d array(3) { [0]=> array(1) { @@ -97,6 +103,12 @@ array(3) { NULL } } + +Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d + +Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d + +Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d array(3) { [0]=> array(1) { diff --git a/ext/standard/tests/array/array_merge_recursive_variation3.phpt b/ext/standard/tests/array/array_merge_recursive_variation3.phpt index 214d7654426b9..a7f746d1076ac 100644 --- a/ext/standard/tests/array/array_merge_recursive_variation3.phpt +++ b/ext/standard/tests/array/array_merge_recursive_variation3.phpt @@ -27,7 +27,7 @@ EOT; // heredoc with different whitespaces $diff_whitespaces = << $blank_line, "h2" => $multiline_string, "h3" => $diff_whitespaces), // with heredocs // associative arrays @@ -59,11 +59,11 @@ $arrays = array ( array("one" => 1, 2 => "two", 4 => "four"), //mixed // associative array, containing null/empty/boolean values as key/value -/*14*/ array(NULL => "NULL", null => "null", "NULL" => NULL, "null" => null), +/*14*/ array(true => "true", false => "false", "false" => false, "true" => true), array("" => "emptyd", '' => 'emptys', "emptyd" => "", 'emptys' => ''), - array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true), - array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6), + array(1 => '', 2 => "", 5 => false, 6 => true), + array('' => 1, "" => 2, false => 5, true => 6), // array containing embedded arrays /*15*/ array("str1", "array" => array("hello", 'world'), array(1, 2)) @@ -236,7 +236,8 @@ array(4) { [0]=> string(3) "a " [1]=> - string(5) "aaaa " + string(5) "aaaa +" [2]=> string(1) "b" [3]=> @@ -247,7 +248,8 @@ array(8) { [0]=> string(3) "a " [1]=> - string(5) "aaaa " + string(5) "aaaa +" [2]=> string(1) "b" [3]=> @@ -274,7 +276,7 @@ array(4) { [0]=> string(5) "a\v\f" [1]=> - string(6) "aaaa\r" + string(6) "aaaa\n" [2]=> string(1) "b" [3]=> @@ -285,7 +287,7 @@ array(8) { [0]=> string(5) "a\v\f" [1]=> - string(6) "aaaa\r" + string(6) "aaaa\n" [2]=> string(1) "b" [3]=> @@ -318,7 +320,8 @@ The quick brown fox jumped over; the lazy dog This is a double quoted string" ["h3"]=> - string(88) "hello world + string(88) "hello + world 1111 != 2222 heredoc double quoted string. with different white spaces" @@ -334,7 +337,8 @@ The quick brown fox jumped over; the lazy dog This is a double quoted string" ["h3"]=> - string(88) "hello world + string(88) "hello + world 1111 != 2222 heredoc double quoted string. with different white spaces" @@ -518,40 +522,6 @@ array(7) { } -- Iteration 14 -- -- With default argument -- -array(3) { - [""]=> - string(4) "null" - ["NULL"]=> - NULL - ["null"]=> - NULL -} --- With more arguments -- -array(7) { - [""]=> - string(4) "null" - ["NULL"]=> - NULL - ["null"]=> - NULL - [0]=> - string(3) "one" - [1]=> - int(2) - ["string"]=> - string(5) "hello" - ["array"]=> - array(3) { - [0]=> - string(1) "a" - [1]=> - string(1) "b" - [2]=> - string(1) "c" - } -} --- Iteration 15 -- --- With default argument -- array(4) { [0]=> string(4) "true" @@ -588,7 +558,7 @@ array(8) { string(1) "c" } } --- Iteration 16 -- +-- Iteration 15 -- -- With default argument -- array(3) { [""]=> @@ -622,39 +592,31 @@ array(7) { string(1) "c" } } --- Iteration 17 -- +-- Iteration 16 -- -- With default argument -- -array(6) { +array(4) { [0]=> string(0) "" [1]=> string(0) "" [2]=> - NULL - [3]=> - NULL - [4]=> bool(false) - [5]=> + [3]=> bool(true) } -- With more arguments -- -array(10) { +array(8) { [0]=> string(0) "" [1]=> string(0) "" [2]=> - NULL - [3]=> - NULL - [4]=> bool(false) - [5]=> + [3]=> bool(true) - [6]=> + [4]=> string(3) "one" - [7]=> + [5]=> int(2) ["string"]=> string(5) "hello" @@ -668,11 +630,11 @@ array(10) { string(1) "c" } } --- Iteration 18 -- +-- Iteration 17 -- -- With default argument -- array(3) { [""]=> - int(4) + int(2) [0]=> int(5) [1]=> @@ -681,7 +643,7 @@ array(3) { -- With more arguments -- array(7) { [""]=> - int(4) + int(2) [0]=> int(5) [1]=> @@ -702,7 +664,7 @@ array(7) { string(1) "c" } } --- Iteration 19 -- +-- Iteration 18 -- -- With default argument -- array(3) { [0]=> diff --git a/ext/standard/tests/array/array_merge_recursive_variation4.phpt b/ext/standard/tests/array/array_merge_recursive_variation4.phpt index 71f4a4d66fbcc..e5dcc5b9cc25a 100644 --- a/ext/standard/tests/array/array_merge_recursive_variation4.phpt +++ b/ext/standard/tests/array/array_merge_recursive_variation4.phpt @@ -9,10 +9,6 @@ Test array_merge_recursive() function : usage variations - associative array wit echo "*** Testing array_merge_recursive() : assoc. array with diff. keys to \$arr1 argument ***\n"; -// get an unset variable -$unset_var = 10; -unset ($unset_var); - // get a resource variable $fp = fopen(__FILE__, "r"); @@ -41,7 +37,7 @@ $arrays = array ( array("hello", $heredoc => array("heredoc", 'string'), "string"), // array with object, unset variable and resource variable -/*8*/ array(@$unset_var => array("unset"), $fp => 'resource', 11, "hello") +/*8*/ array($fp => 'resource', 11, "hello") ); // initialise the second array @@ -292,12 +288,7 @@ array(7) { } -- Iteration 6 -- -- With default argument -- -array(4) { - [""]=> - array(1) { - [0]=> - string(5) "unset" - } +array(3) { [0]=> string(8) "resource" [1]=> @@ -306,12 +297,7 @@ array(4) { string(5) "hello" } -- With more arguments -- -array(8) { - [""]=> - array(1) { - [0]=> - string(5) "unset" - } +array(7) { [0]=> string(8) "resource" [1]=> diff --git a/ext/standard/tests/array/array_merge_variation4.phpt b/ext/standard/tests/array/array_merge_variation4.phpt index e34bf73526886..ad4ee5b248170 100644 --- a/ext/standard/tests/array/array_merge_variation4.phpt +++ b/ext/standard/tests/array/array_merge_variation4.phpt @@ -12,10 +12,6 @@ echo "*** Testing array_merge() : usage variations ***\n"; // Initialise function arguments not being substituted $arr = array ('one' => 1, 'two' => 2); -//get an unset variable -$unset_var = 10; -unset ($unset_var); - // heredoc string $heredoc = << 'negative', ), - // null data -/*4*/ 'null uppercase' => array( - NULL => 'null 1', - ), - -/*5*/ 'null lowercase' => array( - null => 'null 2', - ), - // boolean data /*6*/ 'bool lowercase' => array( true => 'lowert', false => 'lowerf', ), -/*7*/ 'bool uppercase' => array( - TRUE => 'uppert', - FALSE => 'upperf', - ), - // empty data -/*8*/ 'empty double quotes' => array( - "" => 'emptyd', - ), - /*9*/ 'empty single quotes' => array( '' => 'emptys', ), @@ -67,16 +45,6 @@ $inputs = array( 'strings' => 'strings', $heredoc => 'stringh', ), - - // undefined data -/*11*/ 'undefined' => array( - @$undefined_var => 'undefined', - ), - - // unset data -/*12*/ 'unset' => array( - @$unset_var => 'unset', - ), ); // loop through each element of $inputs to check the behavior of array_merge @@ -123,43 +91,7 @@ array(6) { string(8) "negative" } --- Iteration 2: null uppercase data -- -array(3) { - [""]=> - string(6) "null 1" - ["one"]=> - int(1) - ["two"]=> - int(2) -} -array(3) { - ["one"]=> - int(1) - ["two"]=> - int(2) - [""]=> - string(6) "null 1" -} - --- Iteration 3: null lowercase data -- -array(3) { - [""]=> - string(6) "null 2" - ["one"]=> - int(1) - ["two"]=> - int(2) -} -array(3) { - ["one"]=> - int(1) - ["two"]=> - int(2) - [""]=> - string(6) "null 2" -} - --- Iteration 4: bool lowercase data -- +-- Iteration 2: bool lowercase data -- array(4) { [0]=> string(6) "lowert" @@ -181,47 +113,7 @@ array(4) { string(6) "lowerf" } --- Iteration 5: bool uppercase data -- -array(4) { - [0]=> - string(6) "uppert" - [1]=> - string(6) "upperf" - ["one"]=> - int(1) - ["two"]=> - int(2) -} -array(4) { - ["one"]=> - int(1) - ["two"]=> - int(2) - [0]=> - string(6) "uppert" - [1]=> - string(6) "upperf" -} - --- Iteration 6: empty double quotes data -- -array(3) { - [""]=> - string(6) "emptyd" - ["one"]=> - int(1) - ["two"]=> - int(2) -} -array(3) { - ["one"]=> - int(1) - ["two"]=> - int(2) - [""]=> - string(6) "emptyd" -} - --- Iteration 7: empty single quotes data -- +-- Iteration 3: empty single quotes data -- array(3) { [""]=> string(6) "emptys" @@ -239,7 +131,7 @@ array(3) { string(6) "emptys" } --- Iteration 8: string data -- +-- Iteration 4: string data -- array(5) { ["stringd"]=> string(7) "stringd" @@ -264,40 +156,4 @@ array(5) { ["hello world"]=> string(7) "stringh" } - --- Iteration 9: undefined data -- -array(3) { - [""]=> - string(9) "undefined" - ["one"]=> - int(1) - ["two"]=> - int(2) -} -array(3) { - ["one"]=> - int(1) - ["two"]=> - int(2) - [""]=> - string(9) "undefined" -} - --- Iteration 10: unset data -- -array(3) { - [""]=> - string(5) "unset" - ["one"]=> - int(1) - ["two"]=> - int(2) -} -array(3) { - ["one"]=> - int(1) - ["two"]=> - int(2) - [""]=> - string(5) "unset" -} Done diff --git a/ext/standard/tests/array/array_merge_variation7.phpt b/ext/standard/tests/array/array_merge_variation7.phpt index a196effc75bdc..546206872730e 100644 --- a/ext/standard/tests/array/array_merge_variation7.phpt +++ b/ext/standard/tests/array/array_merge_variation7.phpt @@ -11,7 +11,7 @@ echo "*** Testing array_merge() : usage variations ***\n"; //mixed keys $arr1 = array('zero', 20 => 'twenty', 'thirty' => 30, true => 'bool'); -$arr2 = array(0, 1, 2, null => 'null', 0 => 'float'); +$arr2 = array(0, 1, 2, 0 => 'float'); var_dump(array_merge($arr1, $arr2)); var_dump(array_merge($arr2, $arr1)); @@ -20,7 +20,7 @@ echo "Done"; ?> --EXPECT-- *** Testing array_merge() : usage variations *** -array(8) { +array(7) { [0]=> string(4) "zero" [1]=> @@ -35,18 +35,14 @@ array(8) { int(1) [5]=> int(2) - [""]=> - string(4) "null" } -array(8) { +array(7) { [0]=> string(5) "float" [1]=> int(1) [2]=> int(2) - [""]=> - string(4) "null" [3]=> string(4) "zero" [4]=> diff --git a/ext/standard/tests/array/array_pad_variation6.phpt b/ext/standard/tests/array/array_pad_variation6.phpt index fc2d705dbe0f2..800f03ca91533 100644 --- a/ext/standard/tests/array/array_pad_variation6.phpt +++ b/ext/standard/tests/array/array_pad_variation6.phpt @@ -28,7 +28,7 @@ EOT; // heredoc with different whitespaces $diff_whitespaces = << $blank_line, "h2" => $multiline_string, "h3" => $diff_whitespaces, $numeric_string), // with heredocs // associative arrays @@ -60,11 +60,11 @@ $inputs = array ( array("one" => 1, 2 => "two", 4 => "four"), //mixed // associative array, containing null/empty/boolean values as key/value -/*14*/ array(NULL => "NULL", null => "null", "NULL" => NULL, "null" => null), +/*14*/ array(true => "true", false => "false", "false" => false, "true" => true), array("" => "emptyd", '' => 'emptys', "emptyd" => "", 'emptys' => ''), - array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true), - array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6), + array(1 => '', 2 => "", 5 => false, 6 => true), + array('' => 1, "" => 2, false => 5, true => 6), // array with repetitive keys /*19*/ array("One" => 1, "two" => 2, "One" => 10, "two" => 20, "three" => 3) @@ -237,7 +237,8 @@ array(6) { [0]=> string(3) "a " [1]=> - string(5) "aaaa " + string(5) "aaaa +" [2]=> string(5) "b bbb" [3]=> @@ -255,7 +256,8 @@ array(6) { [2]=> string(3) "a " [3]=> - string(5) "aaaa " + string(5) "aaaa +" [4]=> string(5) "b bbb" [5]=> @@ -266,7 +268,7 @@ array(6) { [0]=> string(5) "a\v\f" [1]=> - string(6) "aaaa\r" + string(6) "aaaa\n" [2]=> string(6) "b\tbbb" [3]=> @@ -284,7 +286,7 @@ array(6) { [2]=> string(5) "a\v\f" [3]=> - string(6) "aaaa\r" + string(6) "aaaa\n" [4]=> string(6) "b\tbbb" [5]=> @@ -301,7 +303,8 @@ The big brown fox jumped over; the lazy dog This is a double quoted string" ["h3"]=> - string(88) "hello world + string(88) "hello + world 1111 != 2222 heredoc double quoted string. with different white spaces" @@ -330,7 +333,8 @@ The big brown fox jumped over; the lazy dog This is a double quoted string" ["h3"]=> - string(88) "hello world + string(88) "hello + world 1111 != 2222 heredoc double quoted string. with different white spaces" @@ -487,35 +491,6 @@ array(6) { string(4) "four" } -- Iteration 14 -- -array(6) { - [""]=> - string(4) "null" - ["NULL"]=> - NULL - ["null"]=> - NULL - [0]=> - string(5) "HELLO" - [1]=> - string(5) "HELLO" - [2]=> - string(5) "HELLO" -} -array(6) { - [0]=> - string(5) "HELLO" - [1]=> - string(5) "HELLO" - [2]=> - string(5) "HELLO" - [""]=> - string(4) "null" - ["NULL"]=> - NULL - ["null"]=> - NULL -} --- Iteration 15 -- array(6) { [0]=> string(4) "true" @@ -544,7 +519,7 @@ array(6) { ["true"]=> bool(true) } --- Iteration 16 -- +-- Iteration 15 -- array(6) { [""]=> string(6) "emptys" @@ -573,39 +548,39 @@ array(6) { ["emptys"]=> string(0) "" } --- Iteration 17 -- +-- Iteration 16 -- array(6) { + [0]=> + string(0) "" [1]=> string(0) "" [2]=> - string(0) "" + bool(false) [3]=> - NULL + bool(true) [4]=> - NULL + string(5) "HELLO" [5]=> - bool(false) - [6]=> - bool(true) + string(5) "HELLO" } array(6) { + [0]=> + string(5) "HELLO" [1]=> - string(0) "" + string(5) "HELLO" [2]=> string(0) "" [3]=> - NULL + string(0) "" [4]=> - NULL - [5]=> bool(false) - [6]=> + [5]=> bool(true) } --- Iteration 18 -- +-- Iteration 17 -- array(6) { [""]=> - int(4) + int(2) [0]=> int(5) [1]=> @@ -625,13 +600,13 @@ array(6) { [2]=> string(5) "HELLO" [""]=> - int(4) + int(2) [3]=> int(5) [4]=> int(6) } --- Iteration 19 -- +-- Iteration 18 -- array(6) { ["One"]=> int(10) diff --git a/ext/standard/tests/array/array_pop.phpt b/ext/standard/tests/array/array_pop.phpt index 2066f1acb6673..7125a3e6f7f32 100644 --- a/ext/standard/tests/array/array_pop.phpt +++ b/ext/standard/tests/array/array_pop.phpt @@ -18,7 +18,7 @@ $mixed_array = array( array( "1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five" ), array( 1 => "one", 2 => "two", 3 => 7, 4 => "four", 5 => "five" ), array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2 => "float", "F" => "FFF", - "blank" => "", 3 => 3.7, 5 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ), + "blank" => "", 3 => 3.7, 5 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL ), array( 12, "name", 'age', '45' ), array( array("oNe", "tWo", 4), array(10, 20, 30, 40, 50), array() ), array( "one" => 1, "one" => 2, "three" => 3, 3, 4, 3 => 33, 4 => 44, 5, 6, @@ -175,7 +175,7 @@ array(12) { [4]=> int(6) [""]=> - int(3) + string(5) "blank" [2]=> string(5) "float" ["F"]=> diff --git a/ext/standard/tests/array/array_pop_variation.phpt b/ext/standard/tests/array/array_pop_variation.phpt index af8b0cc0f9a9e..c36f17baf0a6e 100644 --- a/ext/standard/tests/array/array_pop_variation.phpt +++ b/ext/standard/tests/array/array_pop_variation.phpt @@ -13,7 +13,7 @@ $mixed_array = array( array( "1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five" ), array( 1 => "one", 2 => "two", 3 => 7, 4 => "four", 5 => "five" ), array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2 => "float", "F" => "FFF", - "blank" => "", 3 => 3.7, 5 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ), + "blank" => "", 3 => 3.7, 5 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL ), array( 12, "name", 'age', '45' ), array( array("oNe", "tWo", 4), array(10, 20, 30, 40, 50), array() ), array( "one" => 1, "one" => 2, "three" => 3, 3, 4, 3 => 33, 4 => 44, 5, 6, diff --git a/ext/standard/tests/array/array_push.phpt b/ext/standard/tests/array/array_push.phpt index 1c560adc518ac..f65f4b35e8d0c 100644 --- a/ext/standard/tests/array/array_push.phpt +++ b/ext/standard/tests/array/array_push.phpt @@ -18,7 +18,7 @@ $mixed_array = array( array( "1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five" ), array( 1 => "one", 2 => "two", 3 => 7, 4 => "four", 5 => "five" ), array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2 => "float", "F" => "FFF", - "blank" => "", 3 => 3.7, 5 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ), + "blank" => "", 3 => 3.7, 5 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL), array( 12, "name", 'age', '45' ), array( array("oNe", "tWo", 4), array(10, 20, 30, 40, 50), array() ), array( "one" => 1, "one" => 2, "three" => 3, 3, 4, 3 => 33, 4 => 44, 5, 6, @@ -198,7 +198,7 @@ array(12) { [4]=> int(6) [""]=> - int(3) + string(5) "blank" [2]=> string(5) "float" ["F"]=> diff --git a/ext/standard/tests/array/array_push_variation6.phpt b/ext/standard/tests/array/array_push_variation6.phpt index 610e4efaa0e3e..38801e75da571 100644 --- a/ext/standard/tests/array/array_push_variation6.phpt +++ b/ext/standard/tests/array/array_push_variation6.phpt @@ -11,10 +11,6 @@ echo "*** Testing array_push() : usage variations ***\n"; // Initialise function arguments not being substituted $var = 'value'; -//get an unset variable -$unset_var = 10; -unset ($unset_var); - // heredoc string $heredoc = << 'negative', ), - // null data -/*3*/ 'null uppercase' => array( - NULL => 'null 1', - ), - 'null lowercase' => array( - null => 'null 2', - ), - // boolean data /*4*/ 'bool lowercase' => array( true => 'lowert', false => 'lowerf', ), - 'bool uppercase' => array( - TRUE => 'uppert', - FALSE => 'upperf', - ), // empty data -/*5*/ 'empty double quotes' => array( - "" => 'emptyd', - ), 'empty single quotes' => array( '' => 'emptys', ), @@ -63,27 +44,15 @@ $inputs = array( 'strings' => 'strings', $heredoc => 'stringh', ), - - // undefined data -/*8*/ 'undefined' => array( - @$undefined_var => 'undefined', - ), - - // unset data -/*9*/ 'unset' => array( - @$unset_var => 'unset', - ), ); // loop through each sub-array of $inputs to check the behavior of array_push() -$iterator = 1; foreach($inputs as $key => $input) { - echo "\n-- Iteration $iterator : $key data --\n"; + echo "\n-- $key data --\n"; echo "Before : "; var_dump(count($input)); echo "After : "; var_dump( array_push($input, $var) ); - $iterator++; }; echo "Done"; @@ -91,43 +60,19 @@ echo "Done"; --EXPECT-- *** Testing array_push() : usage variations *** --- Iteration 1 : int data -- +-- int data -- Before : int(4) After : int(5) --- Iteration 2 : null uppercase data -- -Before : int(1) -After : int(2) - --- Iteration 3 : null lowercase data -- -Before : int(1) -After : int(2) - --- Iteration 4 : bool lowercase data -- +-- bool lowercase data -- Before : int(2) After : int(3) --- Iteration 5 : bool uppercase data -- -Before : int(2) -After : int(3) - --- Iteration 6 : empty double quotes data -- -Before : int(1) -After : int(2) - --- Iteration 7 : empty single quotes data -- +-- empty single quotes data -- Before : int(1) After : int(2) --- Iteration 8 : string data -- +-- string data -- Before : int(3) After : int(4) - --- Iteration 9 : undefined data -- -Before : int(1) -After : int(2) - --- Iteration 10 : unset data -- -Before : int(1) -After : int(2) Done diff --git a/ext/standard/tests/array/array_reverse_variation3.phpt b/ext/standard/tests/array/array_reverse_variation3.phpt index b5c222684ee6f..087c10ba8dd10 100644 --- a/ext/standard/tests/array/array_reverse_variation3.phpt +++ b/ext/standard/tests/array/array_reverse_variation3.phpt @@ -9,10 +9,6 @@ Test array_reverse() function : usage variations - different array values for 'a echo "*** Testing array_reverse() : usage variations ***\n"; -//get an unset variable -$unset_var = 10; -unset ($unset_var); - //get a resource variable $fp = fopen(__FILE__, "r"); @@ -46,11 +42,11 @@ $arrays = array ( array("one" => 1, 2 => "two", 4 => "four"), //mixed // associative array, containing null/empty/boolean values as key/value -/*13*/ array(NULL => "NULL", null => "null", "NULL" => NULL, "null" => null), +/*13*/ array(true => "true", false => "false", "false" => false, "true" => true), array("" => "emptyd", '' => 'emptys', "emptyd" => "", 'emptys' => ''), - array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true), - array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6), + array(1 => '', 2 => "", 5 => false, 6 => true), + array('' => 1, "" => 2, false => 5, true => 6), // array with repetitive keys /*18*/ array("One" => 1, "two" => 2, "One" => 10, "two" => 20, "three" => 3) @@ -404,34 +400,6 @@ array(3) { } -- Iteration 13 -- - with default argument - -array(3) { - ["null"]=> - NULL - ["NULL"]=> - NULL - [""]=> - string(4) "null" -} -- with $preserve keys = true - -array(3) { - ["null"]=> - NULL - ["NULL"]=> - NULL - [""]=> - string(4) "null" -} -- with $preserve_keys = false - -array(3) { - ["null"]=> - NULL - ["NULL"]=> - NULL - [""]=> - string(4) "null" -} --- Iteration 14 -- -- with default argument - array(4) { ["true"]=> bool(true) @@ -464,7 +432,7 @@ array(4) { [1]=> string(4) "true" } --- Iteration 15 -- +-- Iteration 14 -- - with default argument - array(3) { ["emptys"]=> @@ -492,53 +460,41 @@ array(3) { [""]=> string(6) "emptys" } --- Iteration 16 -- +-- Iteration 15 -- - with default argument - -array(6) { +array(4) { [0]=> bool(true) [1]=> bool(false) [2]=> - NULL - [3]=> - NULL - [4]=> string(0) "" - [5]=> + [3]=> string(0) "" } - with $preserve keys = true - -array(6) { +array(4) { [6]=> bool(true) [5]=> bool(false) - [4]=> - NULL - [3]=> - NULL [2]=> string(0) "" [1]=> string(0) "" } - with $preserve_keys = false - -array(6) { +array(4) { [0]=> bool(true) [1]=> bool(false) [2]=> - NULL - [3]=> - NULL - [4]=> string(0) "" - [5]=> + [3]=> string(0) "" } --- Iteration 17 -- +-- Iteration 16 -- - with default argument - array(3) { [0]=> @@ -546,7 +502,7 @@ array(3) { [1]=> int(5) [""]=> - int(4) + int(2) } - with $preserve keys = true - array(3) { @@ -555,7 +511,7 @@ array(3) { [0]=> int(5) [""]=> - int(4) + int(2) } - with $preserve_keys = false - array(3) { @@ -564,9 +520,9 @@ array(3) { [1]=> int(5) [""]=> - int(4) + int(2) } --- Iteration 18 -- +-- Iteration 17 -- - with default argument - array(3) { ["three"]=> diff --git a/ext/standard/tests/array/array_reverse_variation4.phpt b/ext/standard/tests/array/array_reverse_variation4.phpt index 4967f6e4dacb0..2cf8d3a68d2f2 100644 --- a/ext/standard/tests/array/array_reverse_variation4.phpt +++ b/ext/standard/tests/array/array_reverse_variation4.phpt @@ -9,10 +9,6 @@ Test array_reverse() function : usage variations - assoc. array with diff. keys echo "*** Testing array_reverse() : usage variations ***\n"; -//get an unset variable -$unset_var = 10; -unset ($unset_var); - //get a class class classA{ public function __toString(){ @@ -42,10 +38,10 @@ $arrays = array ( array("hello", $heredoc => "string"), // heredoc // array with object, unset variable and resource variable - array(@$unset_var => "hello", STDERR => 'resource'), + array(STDERR => 'resource'), // array with mixed values -/*11*/ array('hello' => 1, "fruit" => 2.2, STDERR => 'resource', 133 => "int", @$unset_var => "unset", $heredoc => "heredoc") +/*11*/ array('hello' => 1, "fruit" => 2.2, STDERR => 'resource', 133 => "int", $heredoc => "heredoc") ); // loop through the various elements of $arrays to test array_reverse() @@ -245,33 +241,25 @@ array(2) { } -- Iteration 8 -- - default argument - -array(2) { +array(1) { [0]=> string(8) "resource" - [""]=> - string(5) "hello" } - $preserve keys = true - -array(2) { +array(1) { [3]=> string(8) "resource" - [""]=> - string(5) "hello" } - $preserve_keys = false - -array(2) { +array(1) { [0]=> string(8) "resource" - [""]=> - string(5) "hello" } -- Iteration 9 -- - default argument - -array(6) { +array(5) { ["Hello world"]=> string(7) "heredoc" - [""]=> - string(5) "unset" [0]=> string(3) "int" [1]=> @@ -282,11 +270,9 @@ array(6) { int(1) } - $preserve keys = true - -array(6) { +array(5) { ["Hello world"]=> string(7) "heredoc" - [""]=> - string(5) "unset" [133]=> string(3) "int" [3]=> @@ -297,11 +283,9 @@ array(6) { int(1) } - $preserve_keys = false - -array(6) { +array(5) { ["Hello world"]=> string(7) "heredoc" - [""]=> - string(5) "unset" [0]=> string(3) "int" [1]=> diff --git a/ext/standard/tests/array/array_search_variation2.phpt b/ext/standard/tests/array/array_search_variation2.phpt index c391989f320d9..1f1cec9b64b5e 100644 --- a/ext/standard/tests/array/array_search_variation2.phpt +++ b/ext/standard/tests/array/array_search_variation2.phpt @@ -15,7 +15,7 @@ $misc_array = array ( 0 =>"-.08", "e" =>"5", "y" =>NULL, - NULL =>"", + '' =>"", 0, TRUE, FALSE, diff --git a/ext/standard/tests/array/array_shift_variation3.phpt b/ext/standard/tests/array/array_shift_variation3.phpt index e43bc86858d78..3949015612184 100644 --- a/ext/standard/tests/array/array_shift_variation3.phpt +++ b/ext/standard/tests/array/array_shift_variation3.phpt @@ -8,10 +8,6 @@ Test array_shift() function : usage variations - Pass array with different data echo "*** Testing array_shift() : usage variations ***\n"; -//get an unset variable -$unset_var = 10; -unset ($unset_var); - // heredoc string $heredoc = << 'negative', ), - // null data -/*4*/ 'null uppercase' => array( - NULL => 'null 1', - ), - -/*5*/ 'null lowercase' => array( - null => 'null 2', - ), - // boolean data /*6*/ 'bool lowercase' => array( true => 'lowert', false => 'lowerf', ), -/*7*/ 'bool uppercase' => array( - TRUE => 'uppert', - FALSE => 'upperf', - ), - // empty data -/*8*/ 'empty double quotes' => array( - "" => 'emptyd', - ), /*9*/ 'empty single quotes' => array( '' => 'emptys', @@ -63,16 +42,6 @@ $inputs = array( 'strings' => 'strings', $heredoc => 'stringh', ), - - // undefined data -/*11*/ 'undefined' => array( - @$undefined_var => 'undefined', - ), - - // unset data -/*12*/ 'unset' => array( - @$unset_var => 'unset', - ), ); // loop through each element of $inputs to check the behavior of array_shift() @@ -100,41 +69,19 @@ array(3) { string(8) "negative" } --- Iteration 2 : null uppercase data -- -string(6) "null 1" -array(0) { -} - --- Iteration 3 : null lowercase data -- -string(6) "null 2" -array(0) { -} - --- Iteration 4 : bool lowercase data -- +-- Iteration 2 : bool lowercase data -- string(6) "lowert" array(1) { [0]=> string(6) "lowerf" } --- Iteration 5 : bool uppercase data -- -string(6) "uppert" -array(1) { - [0]=> - string(6) "upperf" -} - --- Iteration 6 : empty double quotes data -- -string(6) "emptyd" -array(0) { -} - --- Iteration 7 : empty single quotes data -- +-- Iteration 3 : empty single quotes data -- string(6) "emptys" array(0) { } --- Iteration 8 : string data -- +-- Iteration 4 : string data -- string(7) "stringd" array(2) { ["strings"]=> @@ -142,14 +89,4 @@ array(2) { ["hello world"]=> string(7) "stringh" } - --- Iteration 9 : undefined data -- -string(9) "undefined" -array(0) { -} - --- Iteration 10 : unset data -- -string(5) "unset" -array(0) { -} Done diff --git a/ext/standard/tests/array/array_slice_variation7.phpt b/ext/standard/tests/array/array_slice_variation7.phpt index d0db376ad5830..53cf70e185780 100644 --- a/ext/standard/tests/array/array_slice_variation7.phpt +++ b/ext/standard/tests/array/array_slice_variation7.phpt @@ -13,10 +13,6 @@ echo "*** Testing array_slice() : usage variations ***\n"; $offset = 0; $length = 10; // to ensure all elements are displayed -//get an unset variable -$unset_var = 10; -unset ($unset_var); - // heredoc string $heredoc = << 'negative', ), - // null data -/*4*/ 'null uppercase' => array( - NULL => 'null 1', - ), - -/*5*/ 'null lowercase' => array( - null => 'null 2', - ), - // boolean data /*6*/ 'bool lowercase' => array( true => 'lowert', false => 'lowerf', ), -/*7*/ 'bool uppercase' => array( - TRUE => 'uppert', - FALSE => 'upperf', - ), - // empty data -/*8*/ 'empty double quotes' => array( - "" => 'emptyd', - ), /*9*/ 'empty single quotes' => array( '' => 'emptys', @@ -68,16 +47,6 @@ $inputs = array( 'strings' => 'strings', $heredoc => 'stringh', ), - - // undefined data -/*11*/ 'undefined' => array( - @$undefined_var => 'undefined', - ), - - // unset data -/*12*/ 'unset' => array( - @$unset_var => 'unset', - ), ); // loop through each element of $inputs to check the behavior of array_slice() @@ -120,31 +89,7 @@ array(4) { string(8) "negative" } --- Iteration 2 : key type is null uppercase -- -$preserve_keys = TRUE -array(1) { - [""]=> - string(6) "null 1" -} -$preserve_keys = FALSE -array(1) { - [""]=> - string(6) "null 1" -} - --- Iteration 3 : key type is null lowercase -- -$preserve_keys = TRUE -array(1) { - [""]=> - string(6) "null 2" -} -$preserve_keys = FALSE -array(1) { - [""]=> - string(6) "null 2" -} - --- Iteration 4 : key type is bool lowercase -- +-- Iteration 2 : key type is bool lowercase -- $preserve_keys = TRUE array(2) { [1]=> @@ -160,35 +105,7 @@ array(2) { string(6) "lowerf" } --- Iteration 5 : key type is bool uppercase -- -$preserve_keys = TRUE -array(2) { - [1]=> - string(6) "uppert" - [0]=> - string(6) "upperf" -} -$preserve_keys = FALSE -array(2) { - [0]=> - string(6) "uppert" - [1]=> - string(6) "upperf" -} - --- Iteration 6 : key type is empty double quotes -- -$preserve_keys = TRUE -array(1) { - [""]=> - string(6) "emptyd" -} -$preserve_keys = FALSE -array(1) { - [""]=> - string(6) "emptyd" -} - --- Iteration 7 : key type is empty single quotes -- +-- Iteration 3 : key type is empty single quotes -- $preserve_keys = TRUE array(1) { [""]=> @@ -200,7 +117,7 @@ array(1) { string(6) "emptys" } --- Iteration 8 : key type is string -- +-- Iteration 4 : key type is string -- $preserve_keys = TRUE array(3) { ["stringd"]=> @@ -219,28 +136,4 @@ array(3) { ["hello world"]=> string(7) "stringh" } - --- Iteration 9 : key type is undefined -- -$preserve_keys = TRUE -array(1) { - [""]=> - string(9) "undefined" -} -$preserve_keys = FALSE -array(1) { - [""]=> - string(9) "undefined" -} - --- Iteration 10 : key type is unset -- -$preserve_keys = TRUE -array(1) { - [""]=> - string(5) "unset" -} -$preserve_keys = FALSE -array(1) { - [""]=> - string(5) "unset" -} Done diff --git a/ext/standard/tests/array/array_unique_variation2.phpt b/ext/standard/tests/array/array_unique_variation2.phpt index 6a9d8e36fd2bc..ca6b33434044b 100644 --- a/ext/standard/tests/array/array_unique_variation2.phpt +++ b/ext/standard/tests/array/array_unique_variation2.phpt @@ -26,7 +26,7 @@ EOT; // heredoc with different whitespaces $diff_whitespaces = << $blank_line, "h2" => $multiline_string, "h3" => $diff_whitespaces, $blank_line), // with heredocs // associative arrays @@ -58,11 +58,11 @@ $inputs = array ( array("one" => 1, 2 => "two", 4 => "four"), //mixed // associative array, containing null/empty/boolean values as key/value -/*14*/ array(NULL => "NULL", null => "null", "NULL" => NULL, "null" => null), +/*14*/ array(true => "true", false => "false", "false" => false, "true" => true), array("" => "emptyd", '' => 'emptys', "emptyd" => "", 'emptys' => ''), - array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true), -/*18*/ array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6), + array(1 => '', 2 => "", 5 => false, 6 => true), +/*18*/ array('' => 1, "" => 2, false => 5, true => 6), ); // loop through each sub-array of $inputs to check the behavior of array_unique() @@ -111,7 +111,8 @@ array(4) { [0]=> string(3) "a " [1]=> - string(5) "aaaa " + string(5) "aaaa +" [2]=> string(1) "b" [4]=> @@ -122,7 +123,7 @@ array(4) { [0]=> string(5) "a\v\f" [1]=> - string(6) "aaaa\r" + string(6) "aaaa\n" [2]=> string(1) "b" [4]=> @@ -139,7 +140,8 @@ The quick brown fox jumped over; the lazy dog This is a double quoted string" ["h3"]=> - string(88) "hello world + string(88) "hello + world 1111 != 2222 heredoc double quoted string. with different white spaces" @@ -184,13 +186,6 @@ array(3) { string(4) "four" } -- Iteration 14 -- -array(2) { - [""]=> - string(4) "null" - ["NULL"]=> - NULL -} --- Iteration 15 -- array(4) { [1]=> string(4) "true" @@ -201,24 +196,24 @@ array(4) { ["true"]=> bool(true) } --- Iteration 16 -- +-- Iteration 15 -- array(2) { [""]=> string(6) "emptys" ["emptyd"]=> string(0) "" } --- Iteration 17 -- +-- Iteration 16 -- array(2) { [1]=> string(0) "" [6]=> bool(true) } --- Iteration 18 -- +-- Iteration 17 -- array(3) { [""]=> - int(4) + int(2) [0]=> int(5) [1]=> diff --git a/ext/standard/tests/array/array_unique_variation3.phpt b/ext/standard/tests/array/array_unique_variation3.phpt index 91b551bb60402..3c1b0f2e35ff7 100644 --- a/ext/standard/tests/array/array_unique_variation3.phpt +++ b/ext/standard/tests/array/array_unique_variation3.phpt @@ -9,10 +9,6 @@ Test array_unique() function : usage variations - associative array with differe echo "*** Testing array_unique() : assoc. array with diff. keys passed to \$input argument ***\n"; -// get an unset variable -$unset_var = 10; -unset ($unset_var); - // get a class class classA { @@ -38,7 +34,7 @@ $inputs = array ( array("hello", $heredoc => "string", "string"), // array with object, unset variable and resource variable -/*8*/ array(@$unset_var => "hello", STDERR => 'resource', 11, "hello"), +/*8*/ array(STDERR => 'resource', 11, "hello"), ); // loop through each sub-array of $inputs to check the behavior of array_unique() @@ -96,11 +92,11 @@ array(2) { } -- Iteration 6 -- array(3) { - [""]=> - string(5) "hello" [3]=> string(8) "resource" [4]=> int(11) + [5]=> + string(5) "hello" } Done diff --git a/ext/standard/tests/array/array_unshift_variation3.phpt b/ext/standard/tests/array/array_unshift_variation3.phpt index 75e39600e1f8a..7af0690d75758 100644 --- a/ext/standard/tests/array/array_unshift_variation3.phpt +++ b/ext/standard/tests/array/array_unshift_variation3.phpt @@ -29,12 +29,11 @@ $arrays = array ( array( "one" => "ten", "two" => "twenty", "three" => "thirty"), // string key/value array("one" => 1, 2 => "two", 4 => "four"), //mixed - // associative array, containing null/empty/boolean values as key/value -/*13*/ array(NULL => "NULL", null => "null", "NULL" => NULL, "null" => null), - array(true => "true", false => "false", "false" => false, "true" => true), + // associative array, containing empty/boolean values as key/value +/*13*/ array(true => "true", false => "false", "false" => false, "true" => true), array("" => "emptyd", '' => 'emptys', "emptyd" => "", 'emptys' => ''), - array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true), - array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6), + array(1 => '', 2 => "", 5 => false, 6 => true), + array('' => 1, "" => 2, false => 5, true => 6), // array with repetitive keys /*18*/ array("One" => 1, "two" => 2, "One" => 10, "two" => 20, "three" => 3) @@ -386,33 +385,6 @@ array(6) { string(4) "four" } -- Iteration 13 -- -int(4) -array(4) { - [0]=> - int(10) - [""]=> - string(4) "null" - ["NULL"]=> - NULL - ["null"]=> - NULL -} -int(6) -array(6) { - [0]=> - int(10) - [1]=> - string(5) "hello" - [2]=> - string(5) "world" - [""]=> - string(4) "null" - ["NULL"]=> - NULL - ["null"]=> - NULL -} --- Iteration 14 -- int(5) array(5) { [0]=> @@ -443,7 +415,7 @@ array(7) { ["true"]=> bool(true) } --- Iteration 15 -- +-- Iteration 14 -- int(4) array(4) { [0]=> @@ -470,9 +442,9 @@ array(6) { ["emptys"]=> string(0) "" } --- Iteration 16 -- -int(7) -array(7) { +-- Iteration 15 -- +int(5) +array(5) { [0]=> int(10) [1]=> @@ -480,16 +452,12 @@ array(7) { [2]=> string(0) "" [3]=> - NULL - [4]=> - NULL - [5]=> bool(false) - [6]=> + [4]=> bool(true) } -int(9) -array(9) { +int(7) +array(7) { [0]=> int(10) [1]=> @@ -501,21 +469,17 @@ array(9) { [4]=> string(0) "" [5]=> - NULL - [6]=> - NULL - [7]=> bool(false) - [8]=> + [6]=> bool(true) } --- Iteration 17 -- +-- Iteration 16 -- int(4) array(4) { [0]=> int(10) [""]=> - int(4) + int(2) [1]=> int(5) [2]=> @@ -530,13 +494,13 @@ array(6) { [2]=> string(5) "world" [""]=> - int(4) + int(2) [3]=> int(5) [4]=> int(6) } --- Iteration 18 -- +-- Iteration 17 -- int(4) array(4) { [0]=> diff --git a/ext/standard/tests/array/array_unshift_variation4.phpt b/ext/standard/tests/array/array_unshift_variation4.phpt index ed89e06311776..2af08f15717e6 100644 --- a/ext/standard/tests/array/array_unshift_variation4.phpt +++ b/ext/standard/tests/array/array_unshift_variation4.phpt @@ -10,10 +10,6 @@ Test array_unshift() function : usage variations - assoc. array with diff. keys echo "*** Testing array_unshift() : associative array with different keys ***\n"; -//get an unset variable -$unset_var = 10; -unset ($unset_var); - //get a resource variable $fp = fopen(__FILE__, "r"); @@ -52,12 +48,12 @@ $arrays = array ( array("hello", $heredoc => "string"), // heredoc // array with object, unset variable and resource variable - array(@$unset_var => "hello", $fp => 'resource'), + array($fp => 'resource'), // array with mixed keys /*11*/ array('hello' => 1, "fruit" => 2.2, $fp => 'resource', 133 => "int", - @$unset_var => "unset", $heredoc => "heredoc") + $heredoc => "heredoc") ); // loop through the various elements of $arrays to test array_unshift() @@ -265,31 +261,27 @@ array(5) { string(6) "string" } -- Iteration 8 -- -int(3) -array(3) { +int(2) +array(2) { [0]=> int(10) - [""]=> - string(5) "hello" [1]=> string(8) "resource" } -int(5) -array(5) { +int(4) +array(4) { [0]=> int(10) [1]=> string(5) "hello" [2]=> string(5) "world" - [""]=> - string(5) "hello" [3]=> string(8) "resource" } -- Iteration 9 -- -int(7) -array(7) { +int(6) +array(6) { [0]=> int(10) ["hello"]=> @@ -300,13 +292,11 @@ array(7) { string(8) "resource" [2]=> string(3) "int" - [""]=> - string(5) "unset" ["Hello world"]=> string(7) "heredoc" } -int(9) -array(9) { +int(8) +array(8) { [0]=> int(10) [1]=> @@ -321,8 +311,6 @@ array(9) { string(8) "resource" [4]=> string(3) "int" - [""]=> - string(5) "unset" ["Hello world"]=> string(7) "heredoc" } diff --git a/ext/standard/tests/array/array_values_variation3.phpt b/ext/standard/tests/array/array_values_variation3.phpt index 4d09a31fb8eef..e7ee302b3d159 100644 --- a/ext/standard/tests/array/array_values_variation3.phpt +++ b/ext/standard/tests/array/array_values_variation3.phpt @@ -9,10 +9,6 @@ Test array_values() function : usage variations - array keys different data type echo "*** Testing array_values() : usage variations ***\n"; -//get an unset variable -$unset_var = 10; -unset ($unset_var); - // heredoc string $heredoc = << 'negative', ), - // null data -/*4*/ 'null uppercase' => array( - NULL => 'null 1', - ), - -/*5*/ 'null lowercase' => array( - null => 'null 2', - ), - // boolean data /*6*/ 'bool lowercase' => array( true => 'lowert', false => 'lowerf', ), -/*7*/ 'bool uppercase' => array( - TRUE => 'uppert', - FALSE => 'upperf', - ), - - // empty data -/*8*/ 'empty double quotes' => array( - "" => 'emptyd', - ), - /*9*/ 'empty single quotes' => array( '' => 'emptys', ), @@ -64,31 +41,19 @@ $inputs = array( 'strings' => 'strings', $heredoc => 'stringh', ), - - // undefined data -/*11*/ 'undefined' => array( - @$undefined_var => 'undefined', - ), - - // unset data -/*12*/ 'unset' => array( - @$unset_var => 'unset', - ), ); // loop through each element of $inputs to check the behavior of array_values() -$iterator = 1; foreach($inputs as $key => $input) { - echo "\n-- Iteration $iterator: $key data --\n"; + echo "\n-- $key data --\n"; var_dump( array_values($input) ); - $iterator++; }; echo "Done"; ?> --EXPECT-- *** Testing array_values() : usage variations *** --- Iteration 1: int data -- +-- int data -- array(4) { [0]=> string(4) "zero" @@ -100,19 +65,7 @@ array(4) { string(8) "negative" } --- Iteration 2: null uppercase data -- -array(1) { - [0]=> - string(6) "null 1" -} - --- Iteration 3: null lowercase data -- -array(1) { - [0]=> - string(6) "null 2" -} - --- Iteration 4: bool lowercase data -- +-- bool lowercase data -- array(2) { [0]=> string(6) "lowert" @@ -120,27 +73,13 @@ array(2) { string(6) "lowerf" } --- Iteration 5: bool uppercase data -- -array(2) { - [0]=> - string(6) "uppert" - [1]=> - string(6) "upperf" -} - --- Iteration 6: empty double quotes data -- -array(1) { - [0]=> - string(6) "emptyd" -} - --- Iteration 7: empty single quotes data -- +-- empty single quotes data -- array(1) { [0]=> string(6) "emptys" } --- Iteration 8: string data -- +-- string data -- array(3) { [0]=> string(7) "stringd" @@ -149,16 +88,4 @@ array(3) { [2]=> string(7) "stringh" } - --- Iteration 9: undefined data -- -array(1) { - [0]=> - string(9) "undefined" -} - --- Iteration 10: unset data -- -array(1) { - [0]=> - string(5) "unset" -} Done diff --git a/ext/standard/tests/array/count_recursive.phpt b/ext/standard/tests/array/count_recursive.phpt index 27896ba2c7fab..598bbe1efef23 100644 --- a/ext/standard/tests/array/count_recursive.phpt +++ b/ext/standard/tests/array/count_recursive.phpt @@ -17,7 +17,7 @@ print "COUNT_RECURSIVE: should be 6, is ".count($arr, COUNT_RECURSIVE)."\n"; print "-- Testing various types with no second argument --\n"; print "COUNT_NORMAL: should be 2, is ".count(array("a", array("b")))."\n"; -$arr = array('a'=>array(NULL, NULL, NULL), 1=>array(NULL=>1, 1=>NULL), +$arr = array('a'=>array(NULL, NULL, NULL), 1=>array(''=>1, 1=>NULL), array(array(array(array(array(NULL)))))); print "-- Testing really cool arrays --\n"; print "COUNT_NORMAL: should be 3, is ".count($arr, COUNT_NORMAL)."\n"; @@ -27,14 +27,14 @@ echo "\n*** Testing possible variations of count() function on arrays ***"; $count_array = array( array(), array( 1 => "string"), - array( "" => "string", 0 => "a", NULL => "b", -1 => "c", + array( "" => "string", 0 => "a", -1 => "c", array(array(array(NULL)))), array( -2 => 12, array(array(1, 2, array(array("0"))))), array( "a" => 1, "b" => -2.344, "b" => "string", "c" => NULL, "d" => -2.344), array( 4 => 1, 3 => -2.344, "3" => "string", "2" => NULL, 1 => -2.344, array()), array( TRUE => TRUE, FALSE => FALSE, "" => "", " " => " ", - NULL => NULL, "\x000" => "\x000", "\000" => "\000"), + "\x000" => "\x000", "\000" => "\000"), array( NULL, 1 => "Hi", "string" => "hello", array("" => "World", "-2.34" => "a", "0" => "b")) ); diff --git a/ext/standard/tests/array/extract_variation4.phpt b/ext/standard/tests/array/extract_variation4.phpt index cdbbce225cb04..86dbdcf6419f6 100644 --- a/ext/standard/tests/array/extract_variation4.phpt +++ b/ext/standard/tests/array/extract_variation4.phpt @@ -6,7 +6,7 @@ Test extract() function (variation 4) $mixed_array = array( array( 1 => "one", 2 => "two", 3 => 7, 4 => "four", 5 => "five" ), array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2 => "float", "F" => "FFF", - "blank" => "", 3 => 3.7, 5 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ), + "blank" => "", 3 => 3.7, 5 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL), array( 12, "name", 'age', '45' ), ); diff --git a/ext/standard/tests/array/extract_variation7.phpt b/ext/standard/tests/array/extract_variation7.phpt index 268a24773643c..3cf80c3ecb1e2 100644 --- a/ext/standard/tests/array/extract_variation7.phpt +++ b/ext/standard/tests/array/extract_variation7.phpt @@ -9,7 +9,7 @@ $a = array( "1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "f var_dump ( extract($a, EXTR_PREFIX_ALL, "same")); $b = array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2 => "float", "F" => "FFF", - "blank" => "", 3 => 3.7, 5 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ); + "blank" => "", 3 => 3.7, 5 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL); var_dump ( extract($b, EXTR_PREFIX_ALL, "same")); var_dump ( extract($b, EXTR_PREFIX_ALL, "diff")); diff --git a/ext/standard/tests/array/in_array_variation2.phpt b/ext/standard/tests/array/in_array_variation2.phpt index 3976232243c48..2b4ac3cfe3a09 100644 --- a/ext/standard/tests/array/in_array_variation2.phpt +++ b/ext/standard/tests/array/in_array_variation2.phpt @@ -14,7 +14,7 @@ $misc_array = array ( 0 =>"-.08", "e" =>"5", "y" =>NULL, - NULL =>"", + '' =>"", 0, TRUE, FALSE, diff --git a/ext/standard/tests/array/key_variation2.phpt b/ext/standard/tests/array/key_variation2.phpt index d1eed890ffc5e..bb0ca07b27383 100644 --- a/ext/standard/tests/array/key_variation2.phpt +++ b/ext/standard/tests/array/key_variation2.phpt @@ -28,31 +28,12 @@ $inputs = array( -2345 => 'negative', ), - // null data -/*4*/ 'null uppercase' => array( - NULL => 'null 1', - ), - -/*5*/ 'null lowercase' => array( - null => 'null 2', - ), - // boolean data /*6*/ 'bool lowercase' => array( true => 'lowert', false => 'lowerf', ), -/*7*/ 'bool uppercase' => array( - TRUE => 'uppert', - FALSE => 'upperf', - ), - - // empty data -/*8*/ 'empty double quotes' => array( - "" => 'emptyd', - ), - /*9*/ 'empty single quotes' => array( '' => 'emptys', ), @@ -63,16 +44,6 @@ $inputs = array( 'strings' => 'strings', $heredoc => 'stringh', ), - - // undefined data -/*11*/ 'undefined' => array( - @$undefined_var => 'undefined', - ), - - // unset data -/*12*/ 'unset' => array( - @$unset_var => 'unset', - ), ); // loop through each element of $inputs to check the behavior of key() @@ -95,33 +66,14 @@ int(1) int(12345) int(-2345) --- Iteration 2 : null uppercase data -- -string(0) "" - --- Iteration 3 : null lowercase data -- -string(0) "" - --- Iteration 4 : bool lowercase data -- -int(1) -int(0) - --- Iteration 5 : bool uppercase data -- +-- Iteration 2 : bool lowercase data -- int(1) int(0) --- Iteration 6 : empty double quotes data -- +-- Iteration 3 : empty single quotes data -- string(0) "" --- Iteration 7 : empty single quotes data -- -string(0) "" - --- Iteration 8 : string data -- +-- Iteration 4 : string data -- string(7) "stringd" string(7) "strings" string(11) "hello world" - --- Iteration 9 : undefined data -- -string(0) "" - --- Iteration 10 : unset data -- -string(0) "" diff --git a/ext/standard/tests/array/sort/arsort_variation11.phpt b/ext/standard/tests/array/sort/arsort_variation11.phpt index b5405ac3d55e6..af72a4599f584 100644 --- a/ext/standard/tests/array/sort/arsort_variation11.phpt +++ b/ext/standard/tests/array/sort/arsort_variation11.phpt @@ -17,7 +17,7 @@ $mixed_values = array ( "sub_array[2,3]" => array(22,-55), "sub_array[2,4]" => array() ), 4 => 4, "4" => "4", 4 => 4.01, "b" => "b", "5" => "5", -2 => -2, -2 => -2.01, - -2 => -2.98989, "-.9" => "-.9", "True" => "True", "" => "", NULL => NULL, + -2 => -2.98989, "-.9" => "-.9", "True" => "True", "" => "", "ab" => "ab", "abcd" => "abcd", 0 => 0.01, -0 => -0, '' => '' , "abcd\x00abcd\x00abcd" => "abcd\x00abcd\x00abcd", 0 => 0.001 ); diff --git a/ext/standard/tests/array/sort/arsort_variation_escape_sequences.phpt b/ext/standard/tests/array/sort/arsort_variation_escape_sequences.phpt index b4a533c42114c..db60f7c93f5a5 100644 --- a/ext/standard/tests/array/sort/arsort_variation_escape_sequences.phpt +++ b/ext/standard/tests/array/sort/arsort_variation_escape_sequences.phpt @@ -14,11 +14,9 @@ const EXPECTED_RESULT = [ "\v" => "\v", "\n" => "\n", "\t" => "\t", - null => null, ]; $array = [ - null => null, "\a" => "\a", "\cx" => "\cx", "\e" => "\e", diff --git a/ext/standard/tests/array/sort/asort_variation11.phpt b/ext/standard/tests/array/sort/asort_variation11.phpt index 82eab55993ac1..e9f3a438e5f12 100644 --- a/ext/standard/tests/array/sort/asort_variation11.phpt +++ b/ext/standard/tests/array/sort/asort_variation11.phpt @@ -17,7 +17,7 @@ $mixed_values = array ( "sub_array[2,3]" => array(22,-55), "sub_array[2,4]" => array() ), 4 => 4, "4" => "4", 4 => 4.01, "b" => "b", "5" => "5", -2 => -2, -2 => -2.01, - -2 => -2.98989, "-.9" => "-.9", "True" => "True", "" => "", NULL => NULL, + -2 => -2.98989, "-.9" => "-.9", "True" => "True", "" => "", "ab" => "ab", "abcd" => "abcd", 0 => 0.01, -0 => -0, '' => '' , "abcd\x00abcd\x00abcd" => "abcd\x00abcd\x00abcd", 0 => 0.001 ); diff --git a/ext/standard/tests/array/sort/asort_variation_escape_sequences.phpt b/ext/standard/tests/array/sort/asort_variation_escape_sequences.phpt index 6de02b66ae0a6..1a33fd197c0fd 100644 --- a/ext/standard/tests/array/sort/asort_variation_escape_sequences.phpt +++ b/ext/standard/tests/array/sort/asort_variation_escape_sequences.phpt @@ -4,7 +4,6 @@ Test asort() function: sorting escape sequences null, "\t" => "\t", "\n" => "\n", "\v" => "\v", @@ -18,7 +17,6 @@ const EXPECTED_RESULT = [ ]; $array = [ - null => null, "\a" => "\a", "\cx" => "\cx", "\e" => "\e", diff --git a/ext/standard/tests/array/sort/krsort_variation8.phpt b/ext/standard/tests/array/sort/krsort_variation8.phpt index 4c1c6f2173d26..9379cf4ec4ff3 100644 --- a/ext/standard/tests/array/sort/krsort_variation8.phpt +++ b/ext/standard/tests/array/sort/krsort_variation8.phpt @@ -18,7 +18,7 @@ $mixed_values = array ( "sub_array[2,3]" => array(22,-55), "sub_array[2,4]" => array() ), 4 => 4, "4" => "4", 4 => 4.01, "b" => "b", "5" => "5", -2 => -2, -2 => -2.01, - -2 => -2.98989, "-.9" => "-.9", "True" => "True", "" => "", NULL => NULL, + -2 => -2.98989, "-.9" => "-.9", "True" => "True", "" => "", "ab" => "ab", "abcd" => "abcd", 0 => 0.01, -0 => -0, '' => '' , "abcd\x00abcd\x00abcd" => "abcd\x00abcd\x00abcd", 0 => 0.001 ); diff --git a/ext/standard/tests/array/sort/krsort_variation_escape_sequences.phpt b/ext/standard/tests/array/sort/krsort_variation_escape_sequences.phpt index ac56df76ed7ca..371980293a0ea 100644 --- a/ext/standard/tests/array/sort/krsort_variation_escape_sequences.phpt +++ b/ext/standard/tests/array/sort/krsort_variation_escape_sequences.phpt @@ -14,11 +14,9 @@ const EXPECTED_RESULT = [ "\v" => "\v", "\n" => "\n", "\t" => "\t", - null => null, ]; $array = [ - null => null, "\a" => "\a", "\cx" => "\cx", "\e" => "\e", diff --git a/ext/standard/tests/array/sort/ksort_variation8.phpt b/ext/standard/tests/array/sort/ksort_variation8.phpt index 236c405c64b95..e04abcfbc4731 100644 --- a/ext/standard/tests/array/sort/ksort_variation8.phpt +++ b/ext/standard/tests/array/sort/ksort_variation8.phpt @@ -17,7 +17,7 @@ $mixed_values = array ( "sub_array[2,3]" => array(22,-55), "sub_array[2,4]" => array() ), 4 => 4, "4" => "4", 4 => 4.01, "b" => "b", "5" => "5", -2 => -2, -2 => -2.01, - -2 => -2.98989, "-.9" => "-.9", "True" => "True", "" => "", NULL => NULL, + -2 => -2.98989, "-.9" => "-.9", "True" => "True", "" => "", "ab" => "ab", "abcd" => "abcd", 0 => 0.01, -0 => -0, '' => '' , "abcd\x00abcd\x00abcd" => "abcd\x00abcd\x00abcd", 0 => 0.001 ); diff --git a/ext/standard/tests/array/sort/ksort_variation_escape_sequences.phpt b/ext/standard/tests/array/sort/ksort_variation_escape_sequences.phpt index e880227b1c9e0..acbcde58defe0 100644 --- a/ext/standard/tests/array/sort/ksort_variation_escape_sequences.phpt +++ b/ext/standard/tests/array/sort/ksort_variation_escape_sequences.phpt @@ -4,7 +4,6 @@ Test ksort() function: sorting escape sequences null, "\t" => "\t", "\n" => "\n", "\v" => "\v", @@ -18,7 +17,6 @@ const EXPECTED_RESULT = [ ]; $array = [ - null => null, "\a" => "\a", "\cx" => "\cx", "\e" => "\e", diff --git a/ext/standard/tests/array/sort/natcasesort_variation11.phpt b/ext/standard/tests/array/sort/natcasesort_variation11.phpt index 5934b5230c51c..bc86669a54520 100644 --- a/ext/standard/tests/array/sort/natcasesort_variation11.phpt +++ b/ext/standard/tests/array/sort/natcasesort_variation11.phpt @@ -8,10 +8,6 @@ Test natcasesort() function : usage variations - Different array keys echo "*** Testing natcasesort() : usage variations ***\n"; -//get an unset variable -$unset_var = 10; -unset ($unset_var); - // heredoc string $heredoc = << 'negative', ), - // null data -/*4*/ 'null uppercase' => array( - NULL => 'null 1', - ), - -/*5*/ 'null lowercase' => array( - null => 'null 2', - ), - // boolean data /*6*/ 'bool lowercase' => array( true => 'lowert', false => 'lowerf', ), -/*7*/ 'bool uppercase' => array( - TRUE => 'uppert', - FALSE => 'upperf', - ), - - // empty data -/*8*/ 'empty double quotes' => array( - "" => 'emptyd', - ), - /*9*/ 'empty single quotes' => array( '' => 'emptys', ), @@ -64,16 +41,6 @@ $inputs = array( $heredoc => 'stringh', ), - // undefined data -/*11*/ 'undefined' => array( - @$undefined_var => 'undefined', - ), - - // unset data -/*12*/ 'unset' => array( - @$unset_var => 'unset', - ), - // duplicate values /*13*/ 'duplicate' => array( 'foo' => 'bar', @@ -112,20 +79,6 @@ array(4) { -- Iteration 2 -- bool(true) -array(1) { - [""]=> - string(6) "null 1" -} - --- Iteration 3 -- -bool(true) -array(1) { - [""]=> - string(6) "null 2" -} - --- Iteration 4 -- -bool(true) array(2) { [0]=> string(6) "lowerf" @@ -133,30 +86,14 @@ array(2) { string(6) "lowert" } --- Iteration 5 -- -bool(true) -array(2) { - [0]=> - string(6) "upperf" - [1]=> - string(6) "uppert" -} - --- Iteration 6 -- -bool(true) -array(1) { - [""]=> - string(6) "emptyd" -} - --- Iteration 7 -- +-- Iteration 3 -- bool(true) array(1) { [""]=> string(6) "emptys" } --- Iteration 8 -- +-- Iteration 4 -- bool(true) array(3) { ["stringd"]=> @@ -167,21 +104,7 @@ array(3) { string(7) "strings" } --- Iteration 9 -- -bool(true) -array(1) { - [""]=> - string(9) "undefined" -} - --- Iteration 10 -- -bool(true) -array(1) { - [""]=> - string(5) "unset" -} - --- Iteration 11 -- +-- Iteration 5 -- bool(true) array(3) { ["foo"]=> diff --git a/ext/standard/tests/array/sort/shuffle_variation4.phpt b/ext/standard/tests/array/sort/shuffle_variation4.phpt index 1d3269e76e933..e2736379624c9 100644 --- a/ext/standard/tests/array/sort/shuffle_variation4.phpt +++ b/ext/standard/tests/array/sort/shuffle_variation4.phpt @@ -33,7 +33,7 @@ $array_arg = array( /*7*/ array("hex1" => 0x123, 'hex2' => 0xabc, "hex\t3" => 0xABC, "hex\04" => 0xAb1), // array with negative hexa values - array(NULL => -0x123, "NULL" => -0xabc, "-ABC" => -0xABC, -0xAB1 => -0xAb1), + array('' => -0x123, "NULL" => -0xabc, "-ABC" => -0xABC, -0xAB1 => -0xAb1), // array with positive octal values /*9*/ array(0123 => 0123, "0234" => 0234, '034' => 034, 00 => 00), @@ -41,9 +41,6 @@ $array_arg = array( // array with negative octal values array(-0123 => -0123, "-0234" => -0234, '-034' => -034), - // array with null values -/*11*/ array(NULL => NULL, "null" => NULL, "NULL" => NULL) - ); // looping to test shuffle() with each sub-array in the $array_arg array @@ -209,17 +206,4 @@ array(3) { [2]=> int(-%d) } - --- Iteration 11 -- -bool(true) - -The output array is: -array(3) { - [0]=> - NULL - [1]=> - NULL - [2]=> - NULL -} Done diff --git a/ext/standard/tests/array/sort/uasort_variation3.phpt b/ext/standard/tests/array/sort/uasort_variation3.phpt index 1b690e4dfd032..75e6e3993fbca 100644 --- a/ext/standard/tests/array/sort/uasort_variation3.phpt +++ b/ext/standard/tests/array/sort/uasort_variation3.phpt @@ -51,19 +51,12 @@ $array_arg = array( // string keys 'key' => 5, //single quoted key "two" => 4, //double quoted key - '' => 3, - "" => 2, + '' => 35, " " => 0, // space as key // bool keys - true => 15, - false => 5, - TRUE => 100, - FALSE => 25, - - // null keys - null => 20, // expecting: value will be replaced by 'NULL' - NULL => 35, + true => 100, + false => 25, // binary key "a".chr(0)."b" => 45, diff --git a/ext/standard/tests/array/sort/usort_variation3.phpt b/ext/standard/tests/array/sort/usort_variation3.phpt index 5478ca09abe28..7987fe3eecdaa 100644 --- a/ext/standard/tests/array/sort/usort_variation3.phpt +++ b/ext/standard/tests/array/sort/usort_variation3.phpt @@ -45,14 +45,12 @@ $array_arg = array( 'key' => 5, //single quoted key "two" => 4, //double quoted key " " => 0, // space as key + '' => 35, // bool keys TRUE => 100, FALSE => 25, - // null keys - NULL => 35, - // binary key "a".chr(0)."b" => 45, b"binary" => 30, diff --git a/ext/standard/tests/strings/join_variation3.phpt b/ext/standard/tests/strings/join_variation3.phpt index dc6661f3bf55f..6e4ba433c957a 100644 --- a/ext/standard/tests/strings/join_variation3.phpt +++ b/ext/standard/tests/strings/join_variation3.phpt @@ -24,12 +24,11 @@ $pieces_arrays = array ( array( "one" => "ten", "two" => "twenty", "three" => "thirty"), // string key/value array("one" => 1, 2 => "two", 4 => "four"), //mixed - // associative array, containing null/empty/boolean values as key/value - array(NULL => "NULL", null => "null", "NULL" => NULL, "null" => null), + // associative array, containing empty/boolean values as key/value array(true => "true", false => "false", "false" => false, "true" => true), array("" => "emptyd", '' => 'emptys', "emptyd" => "", 'emptys' => ''), - array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true), - array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6), + array(1 => '', 2 => "", 5 => false, 6 => true), + array('' => 1, "" => 2, false => 5, true => 6), // array with repetitive keys array("One" => 1, "two" => 2, "One" => 10, "two" => 20, "three" => 3) @@ -79,15 +78,13 @@ string(23) "ten], [twenty], [thirty" -- Iteration 12 -- string(16) "1], [two], [four" -- Iteration 13 -- -string(12) "null], [], [" --- Iteration 14 -- string(22) "true], [false], [], [1" --- Iteration 15 -- +-- Iteration 14 -- string(14) "emptys], [], [" +-- Iteration 15 -- +string(13) "], [], [], [1" -- Iteration 16 -- -string(21) "], [], [], [], [], [1" +string(11) "2], [5], [6" -- Iteration 17 -- -string(11) "4], [5], [6" --- Iteration 18 -- string(13) "10], [20], [3" Done From 8e227c355cbd8435a02ed91654b14b17903f9f13 Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Sun, 19 Oct 2025 23:22:42 +0100 Subject: [PATCH 3/6] Fix opcache --- Zend/Optimizer/sccp.c | 7 ++++++- Zend/Optimizer/zend_inference.c | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Zend/Optimizer/sccp.c b/Zend/Optimizer/sccp.c index 5bae5cf160324..817305393ca18 100644 --- a/Zend/Optimizer/sccp.c +++ b/Zend/Optimizer/sccp.c @@ -1106,6 +1106,11 @@ static void sccp_visit_instr(scdf_ctx *scdf, zend_op *opline, zend_ssa_op *ssa_o if (op2) { SKIP_IF_TOP(op2); + if (Z_TYPE_P(op2) == IS_NULL) { + /* Emits deprecation at run-time. */ + SET_RESULT_BOT(result); + return; + } } /* We want to avoid keeping around intermediate arrays for each SSA variable in the @@ -2290,7 +2295,7 @@ static int try_remove_definition(sccp_ctx *ctx, int var_num, zend_ssa_var *var, break; case ZEND_INIT_ARRAY: case ZEND_ADD_ARRAY_ELEMENT: - if (opline->op2_type == IS_UNUSED) { + if (opline->op2_type == IS_UNUSED || opline->op2_type == IS_NULL) { return 0; } /* break missing intentionally */ diff --git a/Zend/Optimizer/zend_inference.c b/Zend/Optimizer/zend_inference.c index 435edeef18c36..b2479a57b6e98 100644 --- a/Zend/Optimizer/zend_inference.c +++ b/Zend/Optimizer/zend_inference.c @@ -5252,7 +5252,7 @@ ZEND_API bool zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op case ZEND_INIT_ARRAY: return (opline->op2_type != IS_UNUSED) && (t2 & (MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)); case ZEND_ADD_ARRAY_ELEMENT: - return (opline->op2_type == IS_UNUSED) || (t2 & (MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)); + return (opline->op2_type == IS_UNUSED) || (t2 & (MAY_BE_NULL|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)); case ZEND_STRLEN: return (t1 & MAY_BE_ANY) != MAY_BE_STRING; case ZEND_COUNT: From aca79f0722d712c030c9c2c128081704ebce9f0e Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Mon, 20 Oct 2025 00:07:47 +0100 Subject: [PATCH 4/6] Add deprecation warning for array API This is used by array_column(), the AST, and iterators --- Zend/tests/constexpr/constant_expressions_dynamic.phpt | 2 ++ Zend/zend_API.c | 10 +++++++--- ext/spl/tests/iterator_to_array_nonscalar_keys.phpt | 2 ++ ext/standard/tests/array/bug68553.phpt | 4 ++++ 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Zend/tests/constexpr/constant_expressions_dynamic.phpt b/Zend/tests/constexpr/constant_expressions_dynamic.phpt index c5c67248df900..c2f8ded98d9b2 100644 --- a/Zend/tests/constexpr/constant_expressions_dynamic.phpt +++ b/Zend/tests/constexpr/constant_expressions_dynamic.phpt @@ -48,6 +48,8 @@ var_dump( Warning: A non-numeric value encountered in %s on line %d Deprecated: Implicit conversion from float 3.14 to int loses precision in %s on line %d + +Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d int(3) string(4) "1foo" bool(false) diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 865a684e4e240..b5c8b7a1dd490 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -2255,9 +2255,6 @@ ZEND_API zend_result array_set_zval_key(HashTable *ht, zval *key, zval *value) / case IS_STRING: result = zend_symtable_update(ht, Z_STR_P(key), value); break; - case IS_NULL: - result = zend_hash_update(ht, ZSTR_EMPTY_ALLOC(), value); - break; case IS_RESOURCE: zend_use_resource_as_offset(key); result = zend_hash_index_update(ht, Z_RES_HANDLE_P(key), value); @@ -2274,6 +2271,13 @@ ZEND_API zend_result array_set_zval_key(HashTable *ht, zval *key, zval *value) / case IS_DOUBLE: result = zend_hash_index_update(ht, zend_dval_to_lval_safe(Z_DVAL_P(key)), value); break; + case IS_NULL: + zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); + if (UNEXPECTED(EG(exception))) { + return FAILURE; + } + result = zend_hash_update(ht, ZSTR_EMPTY_ALLOC(), value); + break; default: zend_illegal_container_offset(ZSTR_KNOWN(ZEND_STR_ARRAY), key, BP_VAR_W); result = NULL; diff --git a/ext/spl/tests/iterator_to_array_nonscalar_keys.phpt b/ext/spl/tests/iterator_to_array_nonscalar_keys.phpt index 44b4e2a0ebcbb..c5fc21ea8bc76 100644 --- a/ext/spl/tests/iterator_to_array_nonscalar_keys.phpt +++ b/ext/spl/tests/iterator_to_array_nonscalar_keys.phpt @@ -21,4 +21,6 @@ try { ?> --EXPECTF-- Deprecated: Implicit conversion from float 2.5 to int loses precision in %s on line %d + +Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d Cannot access offset of type array on array diff --git a/ext/standard/tests/array/bug68553.phpt b/ext/standard/tests/array/bug68553.phpt index f16c94699d5af..d309171096c95 100644 --- a/ext/standard/tests/array/bug68553.phpt +++ b/ext/standard/tests/array/bug68553.phpt @@ -37,6 +37,10 @@ try { Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d Deprecated: Implicit conversion from float 7.38 to int loses precision in %s on line %d + +Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d + +Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d array(8) { [10]=> array(1) { From 2c56b8afb43ad983e9a7979ec7fe7db901c096ca Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Mon, 20 Oct 2025 16:59:53 +0100 Subject: [PATCH 5/6] Fix mem leak --- .../offsets/null_offset_dep_promoted.phpt | 17 ++++++++++ Zend/zend_vm_def.h | 1 + Zend/zend_vm_execute.h | 32 +++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 Zend/tests/offsets/null_offset_dep_promoted.phpt diff --git a/Zend/tests/offsets/null_offset_dep_promoted.phpt b/Zend/tests/offsets/null_offset_dep_promoted.phpt new file mode 100644 index 0000000000000..c26095d4f745c --- /dev/null +++ b/Zend/tests/offsets/null_offset_dep_promoted.phpt @@ -0,0 +1,17 @@ +--TEST-- +Do not leak when promoting null offset deprecation +--FILE-- + 'bar', null => new stdClass]; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; +} +?> +--EXPECT-- +Exception: Using null as an array offset is deprecated, use an empty string instead diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index e5694d6364aef..f5c5b416bc1ae 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -6281,6 +6281,7 @@ ZEND_VM_C_LABEL(num_index): } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); if (UNEXPECTED(EG(exception))) { + zval_ptr_dtor_nogc(expr_ptr); HANDLE_EXCEPTION(); } str = ZSTR_EMPTY_ALLOC(); diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 94064b55faa45..e809ad9800537 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -7947,6 +7947,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_ADD_ARRAY_ELE } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); if (UNEXPECTED(EG(exception))) { + zval_ptr_dtor_nogc(expr_ptr); HANDLE_EXCEPTION(); } str = ZSTR_EMPTY_ALLOC(); @@ -10430,6 +10431,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_ADD_ARRAY_ELE } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); if (UNEXPECTED(EG(exception))) { + zval_ptr_dtor_nogc(expr_ptr); HANDLE_EXCEPTION(); } str = ZSTR_EMPTY_ALLOC(); @@ -11375,6 +11377,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_ADD_ARRAY_ELE } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); if (UNEXPECTED(EG(exception))) { + zval_ptr_dtor_nogc(expr_ptr); HANDLE_EXCEPTION(); } str = ZSTR_EMPTY_ALLOC(); @@ -12994,6 +12997,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_ADD_ARRAY_ELE } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); if (UNEXPECTED(EG(exception))) { + zval_ptr_dtor_nogc(expr_ptr); HANDLE_EXCEPTION(); } str = ZSTR_EMPTY_ALLOC(); @@ -21300,6 +21304,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_ADD_ARRAY_ELE } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); if (UNEXPECTED(EG(exception))) { + zval_ptr_dtor_nogc(expr_ptr); HANDLE_EXCEPTION(); } str = ZSTR_EMPTY_ALLOC(); @@ -21748,6 +21753,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_ADD_ARRAY_ELE } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); if (UNEXPECTED(EG(exception))) { + zval_ptr_dtor_nogc(expr_ptr); HANDLE_EXCEPTION(); } str = ZSTR_EMPTY_ALLOC(); @@ -22210,6 +22216,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_ADD_ARRAY_ELE } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); if (UNEXPECTED(EG(exception))) { + zval_ptr_dtor_nogc(expr_ptr); HANDLE_EXCEPTION(); } str = ZSTR_EMPTY_ALLOC(); @@ -22621,6 +22628,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_ADD_ARRAY_ELE } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); if (UNEXPECTED(EG(exception))) { + zval_ptr_dtor_nogc(expr_ptr); HANDLE_EXCEPTION(); } str = ZSTR_EMPTY_ALLOC(); @@ -26568,6 +26576,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_ADD_ARRAY_ELE } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); if (UNEXPECTED(EG(exception))) { + zval_ptr_dtor_nogc(expr_ptr); HANDLE_EXCEPTION(); } str = ZSTR_EMPTY_ALLOC(); @@ -29124,6 +29133,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_ADD_ARRAY_ELE } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); if (UNEXPECTED(EG(exception))) { + zval_ptr_dtor_nogc(expr_ptr); HANDLE_EXCEPTION(); } str = ZSTR_EMPTY_ALLOC(); @@ -31234,6 +31244,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_ADD_ARRAY_ELE } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); if (UNEXPECTED(EG(exception))) { + zval_ptr_dtor_nogc(expr_ptr); HANDLE_EXCEPTION(); } str = ZSTR_EMPTY_ALLOC(); @@ -33660,6 +33671,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_ADD_ARRAY_ELE } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); if (UNEXPECTED(EG(exception))) { + zval_ptr_dtor_nogc(expr_ptr); HANDLE_EXCEPTION(); } str = ZSTR_EMPTY_ALLOC(); @@ -46178,6 +46190,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_ADD_ARRAY_ELE } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); if (UNEXPECTED(EG(exception))) { + zval_ptr_dtor_nogc(expr_ptr); HANDLE_EXCEPTION(); } str = ZSTR_EMPTY_ALLOC(); @@ -50022,6 +50035,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_ADD_ARRAY_ELE } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); if (UNEXPECTED(EG(exception))) { + zval_ptr_dtor_nogc(expr_ptr); HANDLE_EXCEPTION(); } str = ZSTR_EMPTY_ALLOC(); @@ -52050,6 +52064,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_ADD_ARRAY_ELE } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); if (UNEXPECTED(EG(exception))) { + zval_ptr_dtor_nogc(expr_ptr); HANDLE_EXCEPTION(); } str = ZSTR_EMPTY_ALLOC(); @@ -55788,6 +55803,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_ADD_ARRAY_ELE } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); if (UNEXPECTED(EG(exception))) { + zval_ptr_dtor_nogc(expr_ptr); HANDLE_EXCEPTION(); } str = ZSTR_EMPTY_ALLOC(); @@ -63435,6 +63451,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_ADD_ARRAY_ELEMENT_ } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); if (UNEXPECTED(EG(exception))) { + zval_ptr_dtor_nogc(expr_ptr); HANDLE_EXCEPTION(); } str = ZSTR_EMPTY_ALLOC(); @@ -65918,6 +65935,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_ADD_ARRAY_ELEMENT_ } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); if (UNEXPECTED(EG(exception))) { + zval_ptr_dtor_nogc(expr_ptr); HANDLE_EXCEPTION(); } str = ZSTR_EMPTY_ALLOC(); @@ -66761,6 +66779,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_ADD_ARRAY_ELEMENT_ } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); if (UNEXPECTED(EG(exception))) { + zval_ptr_dtor_nogc(expr_ptr); HANDLE_EXCEPTION(); } str = ZSTR_EMPTY_ALLOC(); @@ -68380,6 +68399,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_ADD_ARRAY_ELEMENT_ } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); if (UNEXPECTED(EG(exception))) { + zval_ptr_dtor_nogc(expr_ptr); HANDLE_EXCEPTION(); } str = ZSTR_EMPTY_ALLOC(); @@ -76586,6 +76606,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_ADD_ARRAY_ELEMENT_ } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); if (UNEXPECTED(EG(exception))) { + zval_ptr_dtor_nogc(expr_ptr); HANDLE_EXCEPTION(); } str = ZSTR_EMPTY_ALLOC(); @@ -77034,6 +77055,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_ADD_ARRAY_ELEMENT_ } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); if (UNEXPECTED(EG(exception))) { + zval_ptr_dtor_nogc(expr_ptr); HANDLE_EXCEPTION(); } str = ZSTR_EMPTY_ALLOC(); @@ -77496,6 +77518,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_ADD_ARRAY_ELEMENT_ } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); if (UNEXPECTED(EG(exception))) { + zval_ptr_dtor_nogc(expr_ptr); HANDLE_EXCEPTION(); } str = ZSTR_EMPTY_ALLOC(); @@ -77907,6 +77930,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_ADD_ARRAY_ELEMENT_ } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); if (UNEXPECTED(EG(exception))) { + zval_ptr_dtor_nogc(expr_ptr); HANDLE_EXCEPTION(); } str = ZSTR_EMPTY_ALLOC(); @@ -81854,6 +81878,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_ADD_ARRAY_ELEMENT_ } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); if (UNEXPECTED(EG(exception))) { + zval_ptr_dtor_nogc(expr_ptr); HANDLE_EXCEPTION(); } str = ZSTR_EMPTY_ALLOC(); @@ -84410,6 +84435,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_ADD_ARRAY_ELEMENT_ } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); if (UNEXPECTED(EG(exception))) { + zval_ptr_dtor_nogc(expr_ptr); HANDLE_EXCEPTION(); } str = ZSTR_EMPTY_ALLOC(); @@ -86520,6 +86546,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_ADD_ARRAY_ELEMENT_ } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); if (UNEXPECTED(EG(exception))) { + zval_ptr_dtor_nogc(expr_ptr); HANDLE_EXCEPTION(); } str = ZSTR_EMPTY_ALLOC(); @@ -88946,6 +88973,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_ADD_ARRAY_ELEMENT_ } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); if (UNEXPECTED(EG(exception))) { + zval_ptr_dtor_nogc(expr_ptr); HANDLE_EXCEPTION(); } str = ZSTR_EMPTY_ALLOC(); @@ -101464,6 +101492,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_ADD_ARRAY_ELEMENT_ } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); if (UNEXPECTED(EG(exception))) { + zval_ptr_dtor_nogc(expr_ptr); HANDLE_EXCEPTION(); } str = ZSTR_EMPTY_ALLOC(); @@ -105308,6 +105337,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_ADD_ARRAY_ELEMENT_ } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); if (UNEXPECTED(EG(exception))) { + zval_ptr_dtor_nogc(expr_ptr); HANDLE_EXCEPTION(); } str = ZSTR_EMPTY_ALLOC(); @@ -107234,6 +107264,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_ADD_ARRAY_ELEMENT_ } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); if (UNEXPECTED(EG(exception))) { + zval_ptr_dtor_nogc(expr_ptr); HANDLE_EXCEPTION(); } str = ZSTR_EMPTY_ALLOC(); @@ -110972,6 +111003,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_ADD_ARRAY_ELEMENT_ } else if (UNEXPECTED(Z_TYPE_P(offset) == IS_NULL)) { zend_error(E_DEPRECATED, "Using null as an array offset is deprecated, use an empty string instead"); if (UNEXPECTED(EG(exception))) { + zval_ptr_dtor_nogc(expr_ptr); HANDLE_EXCEPTION(); } str = ZSTR_EMPTY_ALLOC(); From fbdbbb0da9795e49dfc69deba1c998a4ead1213a Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Mon, 20 Oct 2025 17:00:30 +0100 Subject: [PATCH 6/6] fix sccp code --- Zend/Optimizer/sccp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zend/Optimizer/sccp.c b/Zend/Optimizer/sccp.c index 817305393ca18..7e2fc2db1b256 100644 --- a/Zend/Optimizer/sccp.c +++ b/Zend/Optimizer/sccp.c @@ -2295,7 +2295,7 @@ static int try_remove_definition(sccp_ctx *ctx, int var_num, zend_ssa_var *var, break; case ZEND_INIT_ARRAY: case ZEND_ADD_ARRAY_ELEMENT: - if (opline->op2_type == IS_UNUSED || opline->op2_type == IS_NULL) { + if (opline->op2_type == IS_UNUSED) { return 0; } /* break missing intentionally */