xref: /PHP-8.2/Zend/tests/bug62653.phpt (revision 302ad0d6)
1--TEST--
2Bug #62653: unset($array[$float]) causes a crash
3--FILE--
4<?php
5$array = array("5"=>"bar");
6$foo = "10.0000"; // gettype($foo) = "string"
7$foo /= 2; //Makes $foo = 5 but still gettype($foo) = "double"
8unset($array[$foo]);
9print_r($array);
10
11$array = array("5"=>"bar");
12$foo = "5";
13unset($array[(float)$foo]);
14print_r($array);
15
16$array = array("5"=>"bar");
17$foo = "10.0000";
18$foo /= 2; //Makes $foo = 5 but still gettype($foo) = "double"
19$name = "foo";
20unset($array[$$name]);
21print_r($array);
22
23?>
24--EXPECT--
25Array
26(
27)
28Array
29(
30)
31Array
32(
33)
34