2006-05-29 10:42:54 +00:00
|
|
|
--TEST--
|
|
|
|
file_put_contents() and invalid parameters
|
|
|
|
--FILE--
|
|
|
|
<?php
|
2006-11-15 07:58:02 +00:00
|
|
|
class foo {
|
|
|
|
function __toString() {
|
|
|
|
return __METHOD__;
|
|
|
|
}
|
|
|
|
}
|
2006-05-29 10:42:54 +00:00
|
|
|
$file = dirname(__FILE__)."/file_put_contents.txt";
|
|
|
|
|
|
|
|
$context = stream_context_create();
|
|
|
|
|
|
|
|
var_dump(file_put_contents($file, $context));
|
|
|
|
var_dump(file_put_contents($file, new stdClass));
|
2006-11-15 07:58:02 +00:00
|
|
|
var_dump(file_put_contents($file, new foo));
|
2006-05-29 10:42:54 +00:00
|
|
|
$fp = fopen($file, "r");
|
|
|
|
var_dump(file_put_contents($file, "string", 0, $fp));
|
|
|
|
|
|
|
|
@unlink($file);
|
|
|
|
|
|
|
|
echo "Done\n";
|
|
|
|
?>
|
|
|
|
--EXPECTF--
|
|
|
|
Warning: file_put_contents(): supplied resource is not a valid stream resource in %s on line %d
|
|
|
|
bool(false)
|
|
|
|
bool(false)
|
2006-11-15 07:58:02 +00:00
|
|
|
int(15)
|
2006-05-29 10:42:54 +00:00
|
|
|
|
|
|
|
Warning: file_put_contents(): supplied resource is not a valid Stream-Context resource in %s on line %d
|
|
|
|
int(6)
|
|
|
|
Done
|