From 7318332fe96d31c13e6cdc7e05f3e8dcf0c80a54 Mon Sep 17 00:00:00 2001 From: Jorg Sowa Date: Fri, 23 Oct 2026 18:39:39 +0200 Subject: [PATCH 1/2] Optimizer: array keys whose conversion may throw Float keys emit a deprecation and resource keys a warning, which an error handler can turn into an exception. Share one key mask in zend_may_throw_ex() so ASSIGN_DIM, INIT_ARRAY, ADD_ARRAY_ELEMENT, FETCH_DIM_W/FETCH_LIST_W, ARRAY_KEY_EXISTS, FETCH_DIM_IS and ISSET_ISEMPTY_DIM_OBJ agree. --- Zend/Optimizer/zend_inference.c | 17 +++++---- .../jit/add_array_element_float_key.phpt | 27 ++++++++++++++ .../tests/jit/array_key_exists_float_key.phpt | 27 ++++++++++++++ .../tests/jit/assign_dim_float_key.phpt | 28 ++++++++++++++ .../tests/jit/fetch_dim_w_float_key.phpt | 37 +++++++++++++++++++ .../tests/jit/init_array_float_key.phpt | 27 ++++++++++++++ .../isset_isempty_dim_obj_resource_key.phpt | 29 +++++++++++++++ ext/opcache/tests/opt/dce_018.phpt | 27 ++++++++++++++ ext/opcache/tests/opt/dce_019.phpt | 27 ++++++++++++++ ext/opcache/tests/opt/dce_020.phpt | 27 ++++++++++++++ ext/opcache/tests/opt/dce_021.phpt | 27 ++++++++++++++ ext/opcache/tests/opt/dce_022.phpt | 29 +++++++++++++++ 12 files changed, 322 insertions(+), 7 deletions(-) create mode 100644 ext/opcache/tests/jit/add_array_element_float_key.phpt create mode 100644 ext/opcache/tests/jit/array_key_exists_float_key.phpt create mode 100644 ext/opcache/tests/jit/assign_dim_float_key.phpt create mode 100644 ext/opcache/tests/jit/fetch_dim_w_float_key.phpt create mode 100644 ext/opcache/tests/jit/init_array_float_key.phpt create mode 100644 ext/opcache/tests/jit/isset_isempty_dim_obj_resource_key.phpt create mode 100644 ext/opcache/tests/opt/dce_018.phpt create mode 100644 ext/opcache/tests/opt/dce_019.phpt create mode 100644 ext/opcache/tests/opt/dce_020.phpt create mode 100644 ext/opcache/tests/opt/dce_021.phpt create mode 100644 ext/opcache/tests/opt/dce_022.phpt diff --git a/Zend/Optimizer/zend_inference.c b/Zend/Optimizer/zend_inference.c index af31ec757bed..7af51a6f4e39 100644 --- a/Zend/Optimizer/zend_inference.c +++ b/Zend/Optimizer/zend_inference.c @@ -4926,6 +4926,9 @@ ZEND_API zend_result zend_ssa_inference(zend_arena **arena, const zend_op_array } /* }}} */ +/* Key types whose conversion to an array offset may emit a diagnostic */ +#define MAY_BE_THROWING_KEY (MAY_BE_DOUBLE|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE) + ZEND_API bool zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op, const zend_op_array *op_array, const zend_ssa *ssa, uint32_t t1, uint32_t t2) { if (opline->op1_type == IS_CV) { @@ -5208,7 +5211,7 @@ ZEND_API bool zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op return 1; } return (t1 & (MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_TRUE|MAY_BE_FALSE|MAY_BE_STRING|MAY_BE_LONG|MAY_BE_DOUBLE)) || opline->op2_type == IS_UNUSED || - (t2 & (MAY_BE_UNDEF|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)); + (t2 & (MAY_BE_UNDEF|MAY_BE_THROWING_KEY)); case ZEND_ASSIGN_OBJ: if (t1 & (MAY_BE_ANY-MAY_BE_OBJECT)) { return 1; @@ -5260,9 +5263,9 @@ ZEND_API bool zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op case ZEND_ROPE_END: return t2 & (MAY_BE_ARRAY|MAY_BE_OBJECT); case ZEND_INIT_ARRAY: - 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_THROWING_KEY); case ZEND_ADD_ARRAY_ELEMENT: - return (opline->op2_type == IS_UNUSED) || (t2 & (MAY_BE_NULL|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)); + return (opline->op2_type == IS_UNUSED) || (t2 & (MAY_BE_NULL|MAY_BE_THROWING_KEY)); case ZEND_STRLEN: return (t1 & MAY_BE_ANY) != MAY_BE_STRING; case ZEND_COUNT: @@ -5289,9 +5292,9 @@ ZEND_API bool zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op case ZEND_FETCH_IS: return (t2 & (MAY_BE_ARRAY|MAY_BE_OBJECT)); case ZEND_ISSET_ISEMPTY_DIM_OBJ: - return (t1 & MAY_BE_OBJECT) || (t2 & (MAY_BE_DOUBLE|MAY_BE_ARRAY|MAY_BE_OBJECT)); + return (t1 & MAY_BE_OBJECT) || (t2 & MAY_BE_THROWING_KEY); case ZEND_FETCH_DIM_IS: - return (t1 & MAY_BE_OBJECT) || (t2 & (MAY_BE_DOUBLE|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)); + return (t1 & MAY_BE_OBJECT) || (t2 & MAY_BE_THROWING_KEY); case ZEND_CAST: switch (opline->extended_value) { case IS_LONG: @@ -5313,7 +5316,7 @@ ZEND_API bool zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op if ((t2 & MAY_BE_ANY) != MAY_BE_ARRAY) { return 1; } - if ((t1 & (MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE))) { + if (t1 & MAY_BE_THROWING_KEY) { return 1; } return 0; @@ -5338,7 +5341,7 @@ ZEND_API bool zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op if (t1 & (MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_STRING|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF)) { return 1; } - if (t2 & (MAY_BE_RESOURCE|MAY_BE_ARRAY|MAY_BE_OBJECT)) { + if (t2 & MAY_BE_THROWING_KEY) { return 1; } if (opline->op2_type == IS_UNUSED) { diff --git a/ext/opcache/tests/jit/add_array_element_float_key.phpt b/ext/opcache/tests/jit/add_array_element_float_key.phpt new file mode 100644 index 000000000000..8d6d4efd2b31 --- /dev/null +++ b/ext/opcache/tests/jit/add_array_element_float_key.phpt @@ -0,0 +1,27 @@ +--TEST-- +JIT ADD_ARRAY_ELEMENT: float key conversion may throw +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.jit=function +opcache.file_update_protection=0 +--EXTENSIONS-- +opcache +--FILE-- + 1]); +} + +try { + test(1.5); +} catch (Exception $e) { + echo $e::class, ": ", $e->getMessage(), "\n"; +} +?> +--EXPECT-- +Exception: Implicit conversion from float 1.5 to int loses precision diff --git a/ext/opcache/tests/jit/array_key_exists_float_key.phpt b/ext/opcache/tests/jit/array_key_exists_float_key.phpt new file mode 100644 index 000000000000..e1c9b62ac23c --- /dev/null +++ b/ext/opcache/tests/jit/array_key_exists_float_key.phpt @@ -0,0 +1,27 @@ +--TEST-- +JIT ARRAY_KEY_EXISTS: float key conversion may throw +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.jit=function +opcache.file_update_protection=0 +--EXTENSIONS-- +opcache +--FILE-- +getMessage(), "\n"; +} +?> +--EXPECT-- +Exception: Implicit conversion from float 1.5 to int loses precision diff --git a/ext/opcache/tests/jit/assign_dim_float_key.phpt b/ext/opcache/tests/jit/assign_dim_float_key.phpt new file mode 100644 index 000000000000..014ccba9260b --- /dev/null +++ b/ext/opcache/tests/jit/assign_dim_float_key.phpt @@ -0,0 +1,28 @@ +--TEST-- +JIT ASSIGN_DIM: float key conversion may throw +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.jit=function +opcache.file_update_protection=0 +--EXTENSIONS-- +opcache +--FILE-- +getMessage(), "\n"; +} +?> +--EXPECT-- +Exception: Implicit conversion from float 1.5 to int loses precision diff --git a/ext/opcache/tests/jit/fetch_dim_w_float_key.phpt b/ext/opcache/tests/jit/fetch_dim_w_float_key.phpt new file mode 100644 index 000000000000..03058e916658 --- /dev/null +++ b/ext/opcache/tests/jit/fetch_dim_w_float_key.phpt @@ -0,0 +1,37 @@ +--TEST-- +JIT FETCH_DIM_W: float key conversion may throw +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.jit=function +opcache.file_update_protection=0 +--EXTENSIONS-- +opcache +--FILE-- +getMessage(), "\n"; +} +?> +--EXPECT-- +destruct +Exception: Implicit conversion from float 1.5 to int loses precision diff --git a/ext/opcache/tests/jit/init_array_float_key.phpt b/ext/opcache/tests/jit/init_array_float_key.phpt new file mode 100644 index 000000000000..315c7f08181b --- /dev/null +++ b/ext/opcache/tests/jit/init_array_float_key.phpt @@ -0,0 +1,27 @@ +--TEST-- +JIT INIT_ARRAY: float key conversion may throw +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.jit=function +opcache.file_update_protection=0 +--EXTENSIONS-- +opcache +--FILE-- + 1]); +} + +try { + test(1.5); +} catch (Exception $e) { + echo $e::class, ": ", $e->getMessage(), "\n"; +} +?> +--EXPECT-- +Exception: Implicit conversion from float 1.5 to int loses precision diff --git a/ext/opcache/tests/jit/isset_isempty_dim_obj_resource_key.phpt b/ext/opcache/tests/jit/isset_isempty_dim_obj_resource_key.phpt new file mode 100644 index 000000000000..cb5ccd6b040e --- /dev/null +++ b/ext/opcache/tests/jit/isset_isempty_dim_obj_resource_key.phpt @@ -0,0 +1,29 @@ +--TEST-- +JIT ISSET_ISEMPTY_DIM_OBJ: resource key conversion may throw +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.jit=function +opcache.file_update_protection=0 +--EXTENSIONS-- +opcache +--FILE-- +getMessage(), "\n"; +} +?> +--EXPECTF-- +Exception: Resource ID#%d used as offset, casting to integer (%d) diff --git a/ext/opcache/tests/opt/dce_018.phpt b/ext/opcache/tests/opt/dce_018.phpt new file mode 100644 index 000000000000..f4613d0d860d --- /dev/null +++ b/ext/opcache/tests/opt/dce_018.phpt @@ -0,0 +1,27 @@ +--TEST-- +DCE must not remove ASSIGN_DIM with a float key +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +opcache.file_update_protection=0 +--EXTENSIONS-- +opcache +--FILE-- +getMessage(), "\n"; +} +?> +--EXPECT-- +Exception: Implicit conversion from float 1.5 to int loses precision diff --git a/ext/opcache/tests/opt/dce_019.phpt b/ext/opcache/tests/opt/dce_019.phpt new file mode 100644 index 000000000000..3996185c84ff --- /dev/null +++ b/ext/opcache/tests/opt/dce_019.phpt @@ -0,0 +1,27 @@ +--TEST-- +DCE must not remove INIT_ARRAY with a float key +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +opcache.file_update_protection=0 +--EXTENSIONS-- +opcache +--FILE-- + 1]; +} + +try { + test(1.5); +} catch (Exception $e) { + echo $e::class, ": ", $e->getMessage(), "\n"; +} +?> +--EXPECT-- +Exception: Implicit conversion from float 1.5 to int loses precision diff --git a/ext/opcache/tests/opt/dce_020.phpt b/ext/opcache/tests/opt/dce_020.phpt new file mode 100644 index 000000000000..722c40506fbc --- /dev/null +++ b/ext/opcache/tests/opt/dce_020.phpt @@ -0,0 +1,27 @@ +--TEST-- +DCE must not remove ADD_ARRAY_ELEMENT with a float key +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +opcache.file_update_protection=0 +--EXTENSIONS-- +opcache +--FILE-- + 1]; +} + +try { + test(1.5); +} catch (Exception $e) { + echo $e::class, ": ", $e->getMessage(), "\n"; +} +?> +--EXPECT-- +Exception: Implicit conversion from float 1.5 to int loses precision diff --git a/ext/opcache/tests/opt/dce_021.phpt b/ext/opcache/tests/opt/dce_021.phpt new file mode 100644 index 000000000000..6cf0fd49779d --- /dev/null +++ b/ext/opcache/tests/opt/dce_021.phpt @@ -0,0 +1,27 @@ +--TEST-- +DCE must not remove ARRAY_KEY_EXISTS with a float key +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +opcache.file_update_protection=0 +--EXTENSIONS-- +opcache +--FILE-- +getMessage(), "\n"; +} +?> +--EXPECT-- +Exception: Implicit conversion from float 1.5 to int loses precision diff --git a/ext/opcache/tests/opt/dce_022.phpt b/ext/opcache/tests/opt/dce_022.phpt new file mode 100644 index 000000000000..d2e0ac1baf49 --- /dev/null +++ b/ext/opcache/tests/opt/dce_022.phpt @@ -0,0 +1,29 @@ +--TEST-- +DCE must not remove ISSET_ISEMPTY_DIM_OBJ with a resource key +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +opcache.file_update_protection=0 +--EXTENSIONS-- +opcache +--FILE-- +getMessage(), "\n"; +} +?> +--EXPECTF-- +Exception: Resource ID#%d used as offset, casting to integer (%d) From d35f91244e4f69688d1555564739ab829afa2a82 Mon Sep 17 00:00:00 2001 From: Jorg Sowa Date: Sat, 24 Oct 2026 14:33:34 +0200 Subject: [PATCH 2/2] Optimizer: null array keys may throw Null keys emit a deprecation since PHP 8.5, which an error handler can turn into an exception. Add MAY_BE_NULL to MAY_BE_THROWING_KEY. --- Zend/Optimizer/zend_inference.c | 4 +- .../tests/jit/array_key_exists_null_key.phpt | 27 ++++++++++++++ .../tests/jit/assign_dim_null_key.phpt | 28 ++++++++++++++ .../tests/jit/fetch_dim_w_null_key.phpt | 37 +++++++++++++++++++ .../tests/jit/init_array_null_key.phpt | 27 ++++++++++++++ .../jit/isset_isempty_dim_obj_null_key.phpt | 28 ++++++++++++++ ext/opcache/tests/opt/dce_023.phpt | 27 ++++++++++++++ ext/opcache/tests/opt/dce_024.phpt | 27 ++++++++++++++ ext/opcache/tests/opt/dce_025.phpt | 27 ++++++++++++++ ext/opcache/tests/opt/dce_026.phpt | 28 ++++++++++++++ 10 files changed, 258 insertions(+), 2 deletions(-) create mode 100644 ext/opcache/tests/jit/array_key_exists_null_key.phpt create mode 100644 ext/opcache/tests/jit/assign_dim_null_key.phpt create mode 100644 ext/opcache/tests/jit/fetch_dim_w_null_key.phpt create mode 100644 ext/opcache/tests/jit/init_array_null_key.phpt create mode 100644 ext/opcache/tests/jit/isset_isempty_dim_obj_null_key.phpt create mode 100644 ext/opcache/tests/opt/dce_023.phpt create mode 100644 ext/opcache/tests/opt/dce_024.phpt create mode 100644 ext/opcache/tests/opt/dce_025.phpt create mode 100644 ext/opcache/tests/opt/dce_026.phpt diff --git a/Zend/Optimizer/zend_inference.c b/Zend/Optimizer/zend_inference.c index 7af51a6f4e39..df2b1eda881b 100644 --- a/Zend/Optimizer/zend_inference.c +++ b/Zend/Optimizer/zend_inference.c @@ -4927,7 +4927,7 @@ ZEND_API zend_result zend_ssa_inference(zend_arena **arena, const zend_op_array /* }}} */ /* Key types whose conversion to an array offset may emit a diagnostic */ -#define MAY_BE_THROWING_KEY (MAY_BE_DOUBLE|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE) +#define MAY_BE_THROWING_KEY (MAY_BE_NULL|MAY_BE_DOUBLE|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE) ZEND_API bool zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op, const zend_op_array *op_array, const zend_ssa *ssa, uint32_t t1, uint32_t t2) { @@ -5265,7 +5265,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_THROWING_KEY); case ZEND_ADD_ARRAY_ELEMENT: - return (opline->op2_type == IS_UNUSED) || (t2 & (MAY_BE_NULL|MAY_BE_THROWING_KEY)); + return (opline->op2_type == IS_UNUSED) || (t2 & MAY_BE_THROWING_KEY); case ZEND_STRLEN: return (t1 & MAY_BE_ANY) != MAY_BE_STRING; case ZEND_COUNT: diff --git a/ext/opcache/tests/jit/array_key_exists_null_key.phpt b/ext/opcache/tests/jit/array_key_exists_null_key.phpt new file mode 100644 index 000000000000..4f0b2f25e6af --- /dev/null +++ b/ext/opcache/tests/jit/array_key_exists_null_key.phpt @@ -0,0 +1,27 @@ +--TEST-- +JIT ARRAY_KEY_EXISTS: null key conversion may throw +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.jit=function +opcache.file_update_protection=0 +--EXTENSIONS-- +opcache +--FILE-- +getMessage(), "\n"; +} +?> +--EXPECT-- +Exception: Using null as the key parameter for array_key_exists() is deprecated, use an empty string instead diff --git a/ext/opcache/tests/jit/assign_dim_null_key.phpt b/ext/opcache/tests/jit/assign_dim_null_key.phpt new file mode 100644 index 000000000000..bb255df6a6c7 --- /dev/null +++ b/ext/opcache/tests/jit/assign_dim_null_key.phpt @@ -0,0 +1,28 @@ +--TEST-- +JIT ASSIGN_DIM: null key conversion may throw +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.jit=function +opcache.file_update_protection=0 +--EXTENSIONS-- +opcache +--FILE-- +getMessage(), "\n"; +} +?> +--EXPECT-- +Exception: Using null as an array offset is deprecated, use an empty string instead diff --git a/ext/opcache/tests/jit/fetch_dim_w_null_key.phpt b/ext/opcache/tests/jit/fetch_dim_w_null_key.phpt new file mode 100644 index 000000000000..3ec27c5893a2 --- /dev/null +++ b/ext/opcache/tests/jit/fetch_dim_w_null_key.phpt @@ -0,0 +1,37 @@ +--TEST-- +JIT FETCH_DIM_W: null key conversion may throw +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.jit=function +opcache.file_update_protection=0 +--EXTENSIONS-- +opcache +--FILE-- +getMessage(), "\n"; +} +?> +--EXPECT-- +destruct +Exception: Using null as an array offset is deprecated, use an empty string instead diff --git a/ext/opcache/tests/jit/init_array_null_key.phpt b/ext/opcache/tests/jit/init_array_null_key.phpt new file mode 100644 index 000000000000..8c62b8df0721 --- /dev/null +++ b/ext/opcache/tests/jit/init_array_null_key.phpt @@ -0,0 +1,27 @@ +--TEST-- +JIT INIT_ARRAY: null key conversion may throw +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.jit=function +opcache.file_update_protection=0 +--EXTENSIONS-- +opcache +--FILE-- + 1]); +} + +try { + test(null); +} catch (Exception $e) { + echo $e::class, ": ", $e->getMessage(), "\n"; +} +?> +--EXPECT-- +Exception: Using null as an array offset is deprecated, use an empty string instead diff --git a/ext/opcache/tests/jit/isset_isempty_dim_obj_null_key.phpt b/ext/opcache/tests/jit/isset_isempty_dim_obj_null_key.phpt new file mode 100644 index 000000000000..2b84e5a4ad61 --- /dev/null +++ b/ext/opcache/tests/jit/isset_isempty_dim_obj_null_key.phpt @@ -0,0 +1,28 @@ +--TEST-- +JIT ISSET_ISEMPTY_DIM_OBJ: null key conversion may throw +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.jit=function +opcache.file_update_protection=0 +--EXTENSIONS-- +opcache +--FILE-- +getMessage(), "\n"; +} +?> +--EXPECT-- +Exception: Using null as an array offset is deprecated, use an empty string instead diff --git a/ext/opcache/tests/opt/dce_023.phpt b/ext/opcache/tests/opt/dce_023.phpt new file mode 100644 index 000000000000..ffb4f3ba846e --- /dev/null +++ b/ext/opcache/tests/opt/dce_023.phpt @@ -0,0 +1,27 @@ +--TEST-- +DCE must not remove ASSIGN_DIM with a null key +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +opcache.file_update_protection=0 +--EXTENSIONS-- +opcache +--FILE-- +getMessage(), "\n"; +} +?> +--EXPECT-- +Exception: Using null as an array offset is deprecated, use an empty string instead diff --git a/ext/opcache/tests/opt/dce_024.phpt b/ext/opcache/tests/opt/dce_024.phpt new file mode 100644 index 000000000000..5db1400c9950 --- /dev/null +++ b/ext/opcache/tests/opt/dce_024.phpt @@ -0,0 +1,27 @@ +--TEST-- +DCE must not remove INIT_ARRAY with a null key +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +opcache.file_update_protection=0 +--EXTENSIONS-- +opcache +--FILE-- + 1]; +} + +try { + test(null); +} catch (Exception $e) { + echo $e::class, ": ", $e->getMessage(), "\n"; +} +?> +--EXPECT-- +Exception: Using null as an array offset is deprecated, use an empty string instead diff --git a/ext/opcache/tests/opt/dce_025.phpt b/ext/opcache/tests/opt/dce_025.phpt new file mode 100644 index 000000000000..16d31607644e --- /dev/null +++ b/ext/opcache/tests/opt/dce_025.phpt @@ -0,0 +1,27 @@ +--TEST-- +DCE must not remove ARRAY_KEY_EXISTS with a null key +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +opcache.file_update_protection=0 +--EXTENSIONS-- +opcache +--FILE-- +getMessage(), "\n"; +} +?> +--EXPECT-- +Exception: Using null as the key parameter for array_key_exists() is deprecated, use an empty string instead diff --git a/ext/opcache/tests/opt/dce_026.phpt b/ext/opcache/tests/opt/dce_026.phpt new file mode 100644 index 000000000000..b582063f7b24 --- /dev/null +++ b/ext/opcache/tests/opt/dce_026.phpt @@ -0,0 +1,28 @@ +--TEST-- +DCE must not remove ISSET_ISEMPTY_DIM_OBJ with a null key +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +opcache.file_update_protection=0 +--EXTENSIONS-- +opcache +--FILE-- +getMessage(), "\n"; +} +?> +--EXPECT-- +Exception: Using null as an array offset is deprecated, use an empty string instead