xref: /PHP-8.1/Zend/tests/bug55135.phpt (revision 30156d58)
1--TEST--
2Bug #55135 (Array keys are no longer type casted in unset())
3--FILE--
4<?php
5// This fails.
6$array = array(1 => 2);
7$a = "1";
8unset($array[$a]);
9print_r($array);
10
11// Those works.
12$array = array(1 => 2);
13$a = 1;
14unset($array[$a]);
15print_r($array);
16
17$array = array(1 => 2);
18unset($array[1]);
19print_r($array);
20
21$array = array(1 => 2);
22
23unset($array["1"]);
24print_r($array);
25?>
26--EXPECT--
27Array
28(
29)
30Array
31(
32)
33Array
34(
35)
36Array
37(
38)
39