xref: /PHP-7.3/Zend/tests/closure_015.phpt (revision f02f9b05)
1--TEST--
2Closure 015: converting to string/unicode
3--FILE--
4<?php
5set_error_handler('myErrorHandler', E_RECOVERABLE_ERROR);
6function myErrorHandler($errno, $errstr, $errfile, $errline) {
7  echo "Error: $errstr at $errfile($errline)\n";
8  return true;
9}
10$x = function() { return 1; };
11print (string) $x;
12print "\n";
13print $x;
14print "\n";
15?>
16--EXPECTF--
17Error: Object of class Closure could not be converted to string at %sclosure_015.php(8)
18
19Error: Object of class Closure could not be converted to string at %sclosure_015.php(10)
20