summaryrefslogtreecommitdiff
path: root/ext/standard/tests/file/file_put_contents.phpt
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2013-03-14 05:42:27 +0000
committer <>2013-04-03 16:25:08 +0000
commitc4dd7a1a684490673e25aaf4fabec5df138854c4 (patch)
tree4d57c44caae4480efff02b90b9be86f44bf25409 /ext/standard/tests/file/file_put_contents.phpt
downloadphp2-master.tar.gz
Imported from /home/lorry/working-area/delta_php2/php-5.4.13.tar.bz2.HEADphp-5.4.13master
Diffstat (limited to 'ext/standard/tests/file/file_put_contents.phpt')
-rw-r--r--ext/standard/tests/file/file_put_contents.phpt32
1 files changed, 32 insertions, 0 deletions
diff --git a/ext/standard/tests/file/file_put_contents.phpt b/ext/standard/tests/file/file_put_contents.phpt
new file mode 100644
index 0000000..4566c37
--- /dev/null
+++ b/ext/standard/tests/file/file_put_contents.phpt
@@ -0,0 +1,32 @@
+--TEST--
+file_put_contents() and invalid parameters
+--FILE--
+<?php
+class foo {
+ function __toString() {
+ return __METHOD__;
+ }
+}
+$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));
+var_dump(file_put_contents($file, new foo));
+$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)
+int(15)
+
+Warning: file_put_contents(): supplied resource is not a valid Stream-Context resource in %s on line %d
+int(6)
+Done