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