xref: /php-src/ext/opcache/tests/inc_array.phpt (revision 4c8093a9)
1--TEST--
2Do not constant fold increment of array
3--FILE--
4<?php
5function test_inc_array() {
6    $a = [];
7    $a++;
8}
9function test_inc_partial_array($k) {
10    $a = [];
11    $a[$k] = 0;
12    $a++;
13}
14try {
15    test_inc_array();
16} catch (TypeError $e) {
17    echo $e->getMessage(), "\n";
18}
19try {
20    test_inc_partial_array(0);
21} catch (TypeError $e) {
22    echo $e->getMessage(), "\n";
23}
24?>
25--EXPECT--
26Cannot increment array
27Cannot increment array
28