1--TEST--
2file_put_contents() and invalid parameters
3--FILE--
4<?php
5class foo {
6    function __toString() {
7        return __METHOD__;
8    }
9}
10$file = __DIR__."/file_put_contents.txt";
11
12$context = stream_context_create();
13
14var_dump(file_put_contents($file, $context));
15var_dump(file_put_contents($file, new stdClass));
16var_dump(file_put_contents($file, new foo));
17$fp = fopen($file, "r");
18var_dump(file_put_contents($file, "string", 0, $fp));
19
20@unlink($file);
21
22echo "Done\n";
23?>
24--EXPECTF--
25Warning: file_put_contents(): supplied resource is not a valid stream resource in %s on line %d
26bool(false)
27bool(false)
28int(15)
29
30Warning: file_put_contents(): supplied resource is not a valid Stream-Context resource in %s on line %d
31int(6)
32Done
33