xref: /PHP-8.0/Zend/tests/bug81159.phpt (revision f0fd5922)
1--TEST--
2Bug #81159: Object to int warning when using an object as a string offset
3--FILE--
4<?php
5
6$s = 'Hello';
7$o = new stdClass();
8try {
9    $s[$o] = 'A';
10} catch (\Throwable $e) {
11    echo $e->getMessage(), "\n";
12}
13try {
14    var_dump($s[$o]);
15} catch (\Throwable $e) {
16    echo $e->getMessage(), "\n";
17}
18?>
19--EXPECT--
20Cannot access offset of type stdClass on string
21Cannot access offset of type stdClass on string
22