xref: /php-src/Zend/tests/bug46701.phpt (revision b8e380ab)
1--TEST--
2Bug #46701 (Creating associative array with long values in the key fails on 32bit linux)
3--SKIPIF--
4<?php if (PHP_INT_SIZE != 4) die('skip this test is for 32bit platforms only'); ?>
5--FILE--
6<?php
7
8$test_array = array(
9    0xcc5c4600 => 1,
10    0xce331a00 => 2
11);
12$test_array[0xce359000] = 3;
13
14var_dump($test_array);
15var_dump($test_array[0xce331a00]);
16
17class foo {
18    public $x;
19
20    public function __construct() {
21        $this->x[0xce359000] = 3;
22        var_dump($this->x);
23    }
24}
25
26new foo;
27
28?>
29--EXPECTF--
30Deprecated: Implicit conversion from float 3428599296 to int loses precision in %s on line %d
31
32Deprecated: Implicit conversion from float 3459455488 to int loses precision in %s on line %d
33
34Deprecated: Implicit conversion from float 3459616768 to int loses precision in %s on line %d
35array(3) {
36  [-866368000]=>
37  int(1)
38  [-835511808]=>
39  int(2)
40  [-835350528]=>
41  int(3)
42}
43
44Deprecated: Implicit conversion from float 3459455488 to int loses precision in %s on line %d
45int(2)
46
47Deprecated: Implicit conversion from float 3459616768 to int loses precision in %s on line %d
48array(1) {
49  [-835350528]=>
50  int(3)
51}
52