closure_015.phpt 530 B

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