xref: /PHP-8.2/Zend/tests/return_types/028.phpt (revision fbe30592)
1--TEST--
2Memory leak when returning TMP/VAR with wrong return type
3--FILE--
4<?php
5
6function foo(): stdClass {
7    $a = new stdClass;
8    $b = [];
9    return [$a, $b];
10}
11
12try {
13    foo();
14} catch (Error $e) {
15    echo $e->getMessage(), " in ", $e->getFile(), " on line ", $e->getLine();
16}
17
18?>
19--EXPECTF--
20foo(): Return value must be of type stdClass, array returned in %s on line %d
21