1--TEST--
2Incrementing/decrementing past max/min value (additional cases)
3--SKIPIF--
4<?php if (PHP_INT_SIZE != 8) die('skip 64 bit test'); ?>
5--FILE--
6<?php
7
8class Test {
9    public int $foo;
10}
11
12$test = new Test;
13
14$test->foo = PHP_INT_MIN;
15try {
16    --$test->foo;
17} catch (TypeError $e) {
18    echo $e->getMessage(), "\n";
19}
20var_dump($test->foo);
21try {
22    $test->foo--;
23} catch (TypeError $e) {
24    echo $e->getMessage(), "\n";
25}
26var_dump($test->foo);
27
28$test->foo = PHP_INT_MAX;
29try {
30    ++$test->foo;
31} catch (TypeError $e) {
32    echo $e->getMessage(), "\n";
33}
34var_dump($test->foo);
35try {
36    $test->foo++;
37} catch (TypeError $e) {
38    echo $e->getMessage(), "\n";
39}
40var_dump($test->foo);
41
42// Do the same things again, but with the property being a reference.
43$ref =& $test->foo;
44
45$test->foo = PHP_INT_MIN;
46try {
47    --$test->foo;
48} catch (TypeError $e) {
49    echo $e->getMessage(), "\n";
50}
51var_dump($test->foo);
52try {
53    $test->foo--;
54} catch (TypeError $e) {
55    echo $e->getMessage(), "\n";
56}
57var_dump($test->foo);
58
59$test->foo = PHP_INT_MAX;
60try {
61    ++$test->foo;
62} catch (TypeError $e) {
63    echo $e->getMessage(), "\n";
64}
65var_dump($test->foo);
66try {
67    $test->foo++;
68} catch (TypeError $e) {
69    echo $e->getMessage(), "\n";
70}
71var_dump($test->foo);
72
73?>
74--EXPECT--
75Cannot decrement property Test::$foo of type int past its minimal value
76int(-9223372036854775808)
77Cannot decrement property Test::$foo of type int past its minimal value
78int(-9223372036854775808)
79Cannot increment property Test::$foo of type int past its maximal value
80int(9223372036854775807)
81Cannot increment property Test::$foo of type int past its maximal value
82int(9223372036854775807)
83Cannot decrement a reference held by property Test::$foo of type int past its minimal value
84int(-9223372036854775808)
85Cannot decrement a reference held by property Test::$foo of type int past its minimal value
86int(-9223372036854775808)
87Cannot increment a reference held by property Test::$foo of type int past its maximal value
88int(9223372036854775807)
89Cannot increment a reference held by property Test::$foo of type int past its maximal value
90int(9223372036854775807)