Annotation of embedaddon/php/ext/posix/tests/posix_setuid_error2.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test 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--
8: Marco Fabbri mrfabbri@gmail.com
9: Francesco Fullone ff@ideato.it
10: #PHPTestFest Cesena Italia on 2009-06-20
11: --FILE--
12: <?php
13:
14:
15: echo "*** Test substituting argument 1 with object values ***\n";
16:
17:
18:
19: function 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: }
25: set_error_handler('test_error_handler');
26:
27:
28:
29: class classWithToString
30: {
31: public function __toString() {
32: return "Class A object";
33: }
34: }
35:
36: class classWithoutToString
37: {
38: }
39:
40: $variation_array = array(
41: 'instance of classWithToString' => new classWithToString(),
42: 'instance of classWithoutToString' => new classWithoutToString(),
43: );
44:
45:
46: foreach ( $variation_array as $var ) {
47: var_dump(posix_setuid( $var ) );
48: }
49: ?>
50: --EXPECTF--
51: *** Test substituting argument 1 with object values ***
52: Error: 2 - posix_setuid() expects parameter 1 to be long, object given, %s
53: bool(false)
54: Error: 2 - posix_setuid() expects parameter 1 to be long, object given, %s
55: bool(false)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>