1--TEST--
2Test function posix_setgid() by substituting argument 1 with object values.
3--SKIPIF--
4<?php
5        if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
6?>
7--CREDITS--
8Marco Fabbri mrfabbri@gmail.com
9Francesco Fullone ff@ideato.it
10#PHPTestFest Cesena Italia on 2009-06-20
11--FILE--
12<?php
13
14
15echo "*** Test substituting argument 1 with object values ***\n";
16
17
18
19function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
20        if (error_reporting() != 0) {
21                // report non-silenced errors
22                echo "Error: $err_no - $err_msg, $filename($linenum)\n";
23        }
24}
25set_error_handler('test_error_handler');
26
27
28
29class classWithToString
30{
31        public function __toString() {
32                return "Class A object";
33        }
34}
35
36class classWithoutToString
37{
38}
39
40$variation_array = array(
41  'instance of classWithToString' => new classWithToString(),
42  'instance of classWithoutToString' => new classWithoutToString(),
43  );
44
45
46foreach ( $variation_array as $var ) {
47  var_dump(posix_setgid( $var  ) );
48}
49?>
50===DONE===
51--EXPECTF--
52*** Test substituting argument 1 with object values ***
53Error: 2 - posix_setgid() expects parameter 1 to be int, object given, %s
54bool(false)
55Error: 2 - posix_setgid() expects parameter 1 to be int, object given, %s
56bool(false)
57===DONE===
58
59