Annotation of embedaddon/php/ext/zlib/tests/gzfile_variation6.phpt, revision 1.1.1.2
1.1 misho 1: --TEST--
2: Test function gzfile() by substituting agument 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:
10:
11: $use_include_path = false;
12:
13:
14: function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
15: if (error_reporting() != 0) {
16: // report non-silenced errors
17: echo "Error: $err_no - $err_msg, $filename($linenum)\n";
18: }
19: }
20: set_error_handler('test_error_handler');
21:
22:
23:
24: class classWithToString
25: {
26: public function __toString() {
27: return "Class A object";
28: }
29: }
30:
31: class classWithoutToString
32: {
33: }
34:
35: $variation = array(
36: 'instance of classWithToString' => new classWithToString(),
37: 'instance of classWithoutToString' => new classWithoutToString(),
38: );
39:
40:
41: foreach ( $variation as $var ) {
42: var_dump(gzfile( $var , $use_include_path ) );
43: }
44: ?>
45: --EXPECTF--
46: Error: 2 - gzfile(Class A object): failed to open stream: No such file or directory, %s(%d)
47: bool(false)
1.1.1.2 ! misho 48: Error: 2 - gzfile() expects parameter 1 to be a valid path, object given, %s(%d)
! 49: NULL
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>