xref: /PHP-8.1/Zend/tests/closure_015.phpt (revision a31f4642)
1--TEST--
2Closure 015: converting to string/unicode
3--FILE--
4<?php
5
6$x = function() { return 1; };
7try {
8    print (string) $x;
9} catch (Error $e) {
10    echo $e->getMessage(), "\n";
11}
12try {
13    print $x;
14} catch (Error $e) {
15    echo $e->getMessage(), "\n";
16}
17
18?>
19--EXPECT--
20Object of class Closure could not be converted to string
21Object of class Closure could not be converted to string
22