xref: /PHP-8.0/Zend/tests/bug73792.phpt (revision b2248789)
1--TEST--
2Bug #73792 (invalid foreach loop hangs script)
3--FILE--
4<?php
5$a = 'aaa';
6
7foreach ($a['2bbb'] as &$value) {
8    echo 'loop';
9}
10
11unset($value);
12echo 'done';
13?>
14--EXPECTF--
15Warning: Illegal string offset "2bbb" in %s on line %d
16
17Fatal error: Uncaught Error: Cannot iterate on string offsets by reference in %sbug73792.php:4
18Stack trace:
19#0 {main}
20  thrown in %sbug73792.php on line 4
21