1--TEST--
2Test function posix_setuid() 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_setuid( $var  ) );
48}
49?>
50--EXPECTF--
51*** Test substituting argument 1 with object values ***
52Error: 2 - posix_setuid() expects parameter 1 to be integer, object given, %s
53bool(false)
54Error: 2 - posix_setuid() expects parameter 1 to be integer, object given, %s
55bool(false)
56