1--TEST--
2Overloaded array access with pre increment/decrement
3--FILE--
4<?php
5set_error_handler(function($severity, $m) {
6	if (str_starts_with($m, 'Indirect modification of overloaded element')) { return; }
7	throw new Exception($m, $severity);
8});
9class Foo implements ArrayAccess {
10    function offsetGet($index): mixed {
11        return range(1, 5);
12    }
13    function offsetSet($index, $newval): void {
14    }
15    function offsetExists($index): bool {
16        return true;
17    }
18    function offsetUnset($index): void {
19    }
20}
21$foo = new Foo;
22try {
23	$foo[0]++;
24} catch (Throwable $ex) {
25	echo $ex->getMessage() . "\n";
26}
27$foo = new Foo;
28try {
29	$foo[0]--;
30} catch (Throwable $ex) {
31	echo $ex->getMessage() . "\n";
32}
33?>
34--EXPECT--
35Cannot increment array
36Cannot decrement array
37