closure_015.phpt 388 B

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