1--TEST--
2Test var_export() function with integer values
3--SKIPIF--
4<?php
5if (PHP_INT_SIZE < 8) {
6        die("skip 64-bit only");
7}
8?>
9--FILE--
10<?php
11echo "*** Testing var_export() with integer values ***\n";
12// different integer values
13$valid_ints = array(
14                '0' => '0',
15                '1' => '1',
16                '-1' => '-1',
17                '-2147483648' => '-2147483648', // max negative integer value
18                '-2147483647' => '-2147483647',
19                '2147483647' => 2147483647,  // max positive integer value
20                '2147483640' => 2147483640,
21                '0x123B' => 0x123B,      // integer as hexadecimal
22                "'0x12ab'" => '0x12ab',
23                "'0Xfff'" => '0Xfff',
24                "'0XFA'" => '0XFA',
25                "-0x80000000" => -0x7FFFFFFF - 1, // max negative integer as hexadecimal
26                "'0x7fffffff'" => '0x7fffffff',  // max positive integer as hexadecimal
27                "0x7FFFFFFF" => 0x7FFFFFFF,  // max positive integer as hexadecimal
28                "'0123'" => '0123',        // integer as octal
29                "01912" => 01,       // should be quivalent to octal 1
30                "-020000000000" => -017777777777 - 1, // max negative integer as octal
31                "017777777777" => 017777777777,  // max positive integer as octal
32);
33
34/* Loop to check for above integer values with var_export() */
35echo "\n*** Output for integer values ***\n";
36foreach($valid_ints as $key => $int_value) {
37    echo "\n-- Iteration: $key --\n";
38    var_export( $int_value );
39    echo "\n";
40    var_export( $int_value, FALSE);
41    echo "\n";
42    var_dump( var_export( $int_value, TRUE) );
43}
44
45?>
46--EXPECT--
47*** Testing var_export() with integer values ***
48
49*** Output for integer values ***
50
51-- Iteration: 0 --
52'0'
53'0'
54string(3) "'0'"
55
56-- Iteration: 1 --
57'1'
58'1'
59string(3) "'1'"
60
61-- Iteration: -1 --
62'-1'
63'-1'
64string(4) "'-1'"
65
66-- Iteration: -2147483648 --
67'-2147483648'
68'-2147483648'
69string(13) "'-2147483648'"
70
71-- Iteration: -2147483647 --
72'-2147483647'
73'-2147483647'
74string(13) "'-2147483647'"
75
76-- Iteration: 2147483647 --
772147483647
782147483647
79string(10) "2147483647"
80
81-- Iteration: 2147483640 --
822147483640
832147483640
84string(10) "2147483640"
85
86-- Iteration: 0x123B --
874667
884667
89string(4) "4667"
90
91-- Iteration: '0x12ab' --
92'0x12ab'
93'0x12ab'
94string(8) "'0x12ab'"
95
96-- Iteration: '0Xfff' --
97'0Xfff'
98'0Xfff'
99string(7) "'0Xfff'"
100
101-- Iteration: '0XFA' --
102'0XFA'
103'0XFA'
104string(6) "'0XFA'"
105
106-- Iteration: -0x80000000 --
107-2147483648
108-2147483648
109string(11) "-2147483648"
110
111-- Iteration: '0x7fffffff' --
112'0x7fffffff'
113'0x7fffffff'
114string(12) "'0x7fffffff'"
115
116-- Iteration: 0x7FFFFFFF --
1172147483647
1182147483647
119string(10) "2147483647"
120
121-- Iteration: '0123' --
122'0123'
123'0123'
124string(6) "'0123'"
125
126-- Iteration: 01912 --
1271
1281
129string(1) "1"
130
131-- Iteration: -020000000000 --
132-2147483648
133-2147483648
134string(11) "-2147483648"
135
136-- Iteration: 017777777777 --
1372147483647
1382147483647
139string(10) "2147483647"
140