1--TEST--
2Test function proc_nice() by substituting argument 1 with object values.
3--CREDITS--
4Italian PHP TestFest 2009 Cesena 19-20-21 june
5Fabio Fabbrucci (fabbrucci@grupporetina.com)
6Michele Orselli (mo@ideato.it)
7Simone Gentili (sensorario@gmail.com)
8--SKIPIF--
9<?php
10if(!function_exists('proc_nice')) die("skip. proc_nice not available ");
11?>
12--FILE--
13<?php
14
15
16echo "*** Test substituting argument 1 with object values ***\n";
17
18
19
20function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
21        if (error_reporting() != 0) {
22                // report non-silenced errors
23                echo "Error: $err_no - $err_msg, $filename($linenum)\n";
24        }
25}
26set_error_handler('test_error_handler');
27
28
29
30class classWithToString
31{
32        public function __toString() {
33                return "Class A object";
34        }
35}
36
37class classWithoutToString
38{
39}
40
41$variation_array = array(
42  'instance of classWithToString' => new classWithToString(),
43  'instance of classWithoutToString' => new classWithoutToString(),
44  );
45
46
47foreach ( $variation_array as $var ) {
48  var_dump(proc_nice( $var  ) );
49}
50?>
51--EXPECTF--
52*** Test substituting argument 1 with object values ***
53Error: 2 - proc_nice() expects parameter 1 to be integer, object given, %s(%d)
54bool(false)
55Error: 2 - proc_nice() expects parameter 1 to be integer, object given, %s(%d)
56bool(false)
57