1--TEST--
2Some string offset errors
3--FILE--
4<?php
5
6function &test() : string {
7    $str = "foo";
8    return $str[0];
9}
10
11function &gen() {
12    $str = "foo";
13    yield $str[0];
14}
15
16try {
17    test();
18} catch (Error $e) {
19    echo $e->getMessage(), "\n";
20}
21
22try {
23    $str = "foo";
24    $str[0] =& $str[1];
25} catch (Error $e) {
26    echo $e->getMessage(), "\n";
27}
28
29try {
30    foreach (gen() as $v) {}
31} catch (Error $e) {
32    echo $e->getMessage(), "\n";
33}
34
35?>
36--EXPECT--
37Cannot create references to/from string offsets
38Cannot create references to/from string offsets
39Cannot create references to/from string offsets
40