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-- 20Return value of foo() must be an instance of stdClass, array returned in %s on line %d 21