readgzfile_variation6.phpt 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. --TEST--
  2. Test function readgzfile() by substituting argument 1 with object values.
  3. --SKIPIF--
  4. <?php
  5. if (!extension_loaded('zlib')) die ('skip zlib extension not available in this build');
  6. ?>
  7. --FILE--
  8. <?php
  9. $use_include_path = false;
  10. function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
  11. if (error_reporting() != 0) {
  12. // report non-silenced errors
  13. echo "Error: $err_no - $err_msg, $filename($linenum)\n";
  14. }
  15. }
  16. set_error_handler('test_error_handler');
  17. class classWithToString
  18. {
  19. public function __toString() {
  20. return "Class A object";
  21. }
  22. }
  23. class classWithoutToString
  24. {
  25. }
  26. $variation = array(
  27. 'instance of classWithToString' => new classWithToString(),
  28. 'instance of classWithoutToString' => new classWithoutToString(),
  29. );
  30. foreach ( $variation as $var ) {
  31. var_dump(readgzfile( $var , $use_include_path ) );
  32. }
  33. ?>
  34. --EXPECTF--
  35. Error: 2 - readgzfile(Class A object): failed to open stream: No such file or directory, %s(%d)
  36. bool(false)
  37. Error: 2 - readgzfile() expects parameter 1 to be a valid path, object given, %s(%d)
  38. NULL